Surefire User's Guide Page 1 Surefire User's Guide - Table of Contents Chapter 1: Introduction 10 What is a Smart Document 11 Chapter Preview 12 Chapter 2: Getting Started 13 Running Surefire 13 Running Surefire with a Document 14 Leaving Surefire 14 System Information 14 System Setup 14 Current Drive and Directory 14 Current Printer and Printer Port 15 Using Your Display 15 Document Related Parameters 16 Tab Size 16 Word Wrap 16 Auto Calc 16 Hints 16 Auto Backup 16 The Surefire Demo/Tutorial 17 Chapter 3: Getting Around 18 The Document 18 The Page Display 18 Menus 18 The Menu Bar 18 Choosing a Menu Item 19 Accelerated Menu Selection 19 Inactive Menu Items 20 Shortcuts 20 Windows 20 Window Fields 20 Data Entry Fields 20 Action Buttons 21 Multiple Choice Buttons 21 Logical Choice Buttons 21 Moving Between Fields 21 Changing Logical and Multiple Choice Buttons 21 Choosing Action Buttons 21 Getting Help 22 The Status Line 22 Hints 22 Context Help 23 Document Help 23 Chapter 4: Typing Text 24 Word Processors -vs- Typewriters 24 Creating a New Document 25 Saving Your Document 25 Cursor Movement 25 Entering Text 26 Surefire User's Guide Page 2 "Wrapped" and "Unwrapped" Paragraphs 27 Typeover and Insert modes 27 Using Typeover Mode 27 Using Insert Mode 27 Deleting Characters 28 Exiting Surefire 28 Chapter 5: Revising a Document 29 Opening a Document 29 Printing a Document 30 Preparation 30 Printing 31 Scrolling 31 Scrolling by Lines, Screens and Pages 32 Two Faces of Editing 33 "Scroll and Change" Editing 33 Moving the Cursor on the Screen 33 Changing Text 34 Removing Text 34 Adding Text 35 Adding and Deleting Lines 35 Good Editing Practices 35 Chapter 6: Locating Text 36 Finding Text 36 Finding Capitalized and Whole Words 36 Using Goto 37 Using Replace 37 Locating Text Using Bookmarks 38 Correcting Spelling Errors Using Replace 40 Chapter 7: Clipboard Editing 41 The Clipboard 41 Clipboard Commands 41 Selecting Text 42 Block Select -vs- Line Select 42 Selecting a Region with Block Select 42 Selecting Sentences with Line Select 43 Return to Normal Operations 43 Canceling a Selection 44 Viewing Clipboard Objects 44 Copying Text 45 Moving Text 45 Pasting Text 46 Paste & Keep 47 Sizing Clipboard Objects 47 Removing Text 48 Recovering Text 49 Chapter 8: Adding Emphasis 50 Character Attributes 50 Giving a Character Attribute to Text 51 Special Characters 51 Indenting Lines and Paragraphs 51 Surefire User's Guide Page 3 Drawing Boxes and Lines 52 Constructing Tables 53 Chapter 9: Page Layout 54 Formatting Choices 54 Changing Character Spacing 55 Changing Printers 57 Rewrapping Paragraphs 58 What is a Paragraph? 58 Changing Margins 58 Page Breaks 59 Adding and Deleting Pages 60 Headers and Footers 61 Automatic Page Numbering 61 Page and Paper Sizes 61 Printing Your Document 63 Chapter 10: The Calculator 64 Mathematical Expressions 64 Using Functions 65 Calculator Errors 66 Pasting a Result 66 Chapter 11: Introduction to Fields 67 Fields and Forms 67 Editing and Using Documents 67 Moving Around a Document via Fields 68 Cursor Tied To Fields 68 Free Cursor 69 Creating Fields 69 Sizing Text and Numeric Fields 70 Field IDs 70 Chapter 12: Field Types and Attributes 71 Format Attributes 71 Data Attributes 71 Text Fields 72 Justified Text Formats 72 Unjustified Text Formats 72 Single vs Multiple Lines 72 Numeric Fields 72 Numeric Appearance 73 Negative Representation 73 Numeric Justification 73 Other Numeric Format Settings 73 Single vs Multiple Cells 74 Date Fields 74 Date Styles 74 Default to Today 75 Logical Fields 75 Button Fields 75 Fixed vs Auto Sized Fields 76 Surefire User's Guide Page 4 Chapter 13: Working With Fields 77 Editing Fields 77 Single vs Multiple Line Fields 78 Modifying Field Attributes 78 Resizing Fields 78 Deleting Fields 79 Editing a Document with Fields as Text 79 Moving and Copying Fields 79 Entering Information into Fields 80 Entering Dates 81 Pop-Lists 82 Creating a Pop-List 82 Using a Pop-List 82 Clearing Field Values 83 Locating Specific Field Values 83 Printing a Document with Fields 83 Copying and Pasting Values Among Fields 84 Copying and Pasting Values To the Calculator 84 Chapter 14: Introducing Field Commands 85 What is a Field Command? 85 What Can Be Done with Field Commands? 86 Field IDs 86 Specifying Commands 87 Entering Field Commands 87 Executing Field Commands 87 Specifying Functions 87 Chapter 15: Using Field Commands 89 Viewing and Editing Field Commands 89 IDs and Names 89 Viewing Field Commands 90 Editing Field Commands 90 Pasting Values From the Calculator 91 IDs and References 91 Ranges 92 Numeric Fields 92 Sum of Numbers 92 Text Fields 93 Tracing References 94 Assignment Statements 94 Implicit Assignment 94 Explicit Assignment to a Field 95 Assignment to a Range of Cells 95 Multiple Statements 95 Operating with Numbers 95 Operating with Text 96 Conditions and Logical Expressions 97 Logical Operators 97 Complex Logical Expressions 98 Logical Condition Function 98 Control Operations 99 Errors in Control Functions 99 Document Levels 99 Surefire User's Guide Page 5 Changing Directories 99 More About Command Execution 100 Automatic Command Execution 100 Explicit Execution by Page or Document 100 Execution by Buttons 101 Execute on Enter 101 Order of Execution 101 Command Errors 101 Chapter 16: Spreadsheets 102 Creating a Spreadsheet 102 Using a Spreadsheet 102 Absolute and Relative References 102 Loading Commands with Relative References 103 Vertical and Horizontal Relative References 103 Absolute/Relative Toggle Key 104 Enlarging a Spreadsheet 105 Using a Range of Fields 105 Selecting a Range of Fields 105 Copy Commands Using Range Selection 106 Horizontal vs Vertical Execution Order 106 Chapter 17: Introduction to Databases 107 Storing Data 107 Specifying a Database Field 107 Database Limits 108 Adding a Data Record 108 Clearing All Fields 109 Simple Data Search 109 Viewing All Records 109 Database Status Information 109 Getting Specific Records 110 Updating a Data Record 110 Deleting a Data Record 111 Chapter 18: Searching a Database 112 Specifying a Query 112 Query Lines 113 Sort Order Multiple Choice Button 113 Sort Direction Multiple Choice Button 113 Field Name and Type 114 Condition Multiple Choice Button 114 Single Conditions 114 The 'All' Condition 115 Range Conditions 115 Adding a Query Line 116 AND'ed Conditions 116 OR'ed Conditions 116 Deleting a Query Line 117 Closing the Query Window 117 Clearing the Current Query 117 Setting Search Options 117 Setting the Record Type 118 Surefire User's Guide Page 6 Named Queries 118 Saving a Query 118 Getting a Query 119 Running a Query 119 Deleting a Query 119 Chapter 19: Sharing Data Among Documents 120 Base Documents vs Projected Documents 120 Projected Fields 121 Projecting Fields Using the Clipboard 121 Projection as a Field Attribute 122 Using Projected Fields vs Original Fields 122 Searching in a Projected Document 122 Printing Your Data 123 Printing the Current Record 123 Printing All Qualifying Records 124 Chapter 20: Forms and Form Letters 125 What You Need to Know 125 Documents with Fields and No Database 126 Documents with Stored Fields 126 Documents with Projected Fields 127 Mailing Labels 127 Printing Mailing Labels 128 Envelopes 129 Form Letters 129 Pre-Printed Forms 130 Chapter 21: Advanced Database Topics 131 Changing the Database Structure 131 Using Calculated Fields 132 Using Hidden Fields 133 Using Database Searching Functions 134 Recalling a Deleted Record 135 Manipulating Record Sets 136 Updating a Record Set 136 Deleting a Record Set 136 Recalling a Record Set 137 Importing and Exporting Data 137 Importing Data 138 Exporting Data 140 Merging and Extracting Surefire Databases 140 Joining Two Databases 141 Chapter 22: Generating Reports 142 Formatting the Report 142 Specifying Repeated Fields 143 Using Trim 144 Clearing the Repeat Specification 144 Displaying at the Top or Bottom of Pages 144 Displaying at the End of a Report 144 Displaying When a Sort Field Changes 145 Turning off Report Formatting 145 Generating a Report 146 Surefire User's Guide Page 7 Resetting a Report 147 Printing a Report 147 Printing After Display 148 Printing the Report Directly 148 Saving a Report 148 Using Statistical Database Functions 149 Generating Reports at the Push of a Button 149 Chapter 23: More About Printing 150 The Print Window 150 Pages to Print 150 Page Numbering 150 Number of Copies 151 Pause Before Printing 151 PRINT and SEARCH & PRINT 151 Printing the Current Document 152 Stopping and Starting the Printer 152 Printers and Printer Drivers 152 What Actually Gets Printed 154 Chapter 24: More About Surefire Documents 156 The Modes of Editing and Using Documents 156 Getting Documents 156 Saving Documents 158 Copying Documents 158 Renaming Documents 159 Deleting Documents 159 Creating a New Document 160 Protecting Documents 160 Specifying Document Help 160 Help File Format 161 Specifying a Document Help Context 162 Chapter 25: Surefire System Topics 163 Backing Up Your Files 163 Manual Backups 163 Automatic File Backup and Recovery 163 Surefire Files 164 Document File Format - WordStar Compatible 165 Database File Format - DBase III Compatible 165 Locking Documents 165 System Constraints 166 Surefire User's Guide Page 8 Appendix A: Surefire Function Reference 167 General Mathematical Functions 167 Absolute Value 167 Integer Value 167 Remainder 167 Rounding 167 Square Root 167 Trigonometric Functions 168 Pi 168 Sine 168 Cosine 168 Tangent 168 Logarithmic Functions 168 Logarithm 168 Power of e 168 Natural Logarithm 168 Financial Functions 169 Future Value 169 Payment Amounts 169 Present Value 169 Compound Growth Rate 169 Statistical Functions 169 Average 169 Count 169 Maximum 170 Minimum 170 Sum 170 Standard Deviation 170 Variance 170 Date Functions 170 Add Days to a Date 171 Date is After? 171 Date is Before? 171 Specify a Date 171 Day of Month 171 Find Days between Dates 171 Month of Year 172 Dates are Same? 172 Subtract Days from a Date 172 Today's Date 172 Year 172 Text of a Date 172 Text of a Month 173 Text of a Day 173 Text Functions 173 Find a String 173 Obtain a String 173 Replace a String 174 Obtain Length of String 174 Remove Trailing Blanks 174 Compare Two Strings 174 Force String to Upper Case 174 Force String to Lower Case 174 Convert a Number to a String 174 Surefire User's Guide Page 9 Put String to a Page 175 Text Buffer Functions 175 Copy Text to Buffer 175 Paste Buffer onto Page 175 Copy Text from Field to Buffer 175 Paste Buffer into Field 176 Time Functions 176 Current Time 176 Time Stamp 176 Control Functions 176 Go To a Page 177 Go To a Field 177 Go To a Document 177 Return to Previous Document 177 Return to Document at Level 178 Run a DOS Command 178 Reset the Document 178 Set Help Context 178 Present a Document 179 Database Statistical Functions 179 Database Search Functions 180 Set Query Conditions 180 Execute a Query 181 Join a Document 181 Start a Search 181 Update Record 181 Logical Value Functions 182 Logical Condition Function 182 Surefire User's Guide Page 10 Chapter 1 - INTRODUCTION We have developed Surefire to help you do a wide variety of tasks in the office and at home. Whether you want to track expenses, send timely correspondence, or keep information about all your clients, employees or favorite recipes, Surefire can meet your needs. You will find that Surefire is easy to use and easy to understand. Menus and windows guide you through all of its features. Help is available when and where you need it. And you know at all times what your printed text will look like without special formatting and viewing procedures. The power of Surefire can be learned and incorporated in stages. Your use and knowledge of Surefire will grow as you discover new ways to automate various tasks. Through reading this manual and exploring the Surefire system, you will gradually learn new powerful concepts. Once you learn to do an operation, the methods for performing that operation are the same no matter how complex your use becomes. This manual presents the concepts of Surefire so you can easily build upon what you know from one stage to the next. As you read this manual, you should take time to understand the concepts that are presented in each chapter. It is not necessary to read each chapter completely before moving on, but understanding the key concepts will make understanding subsequent chapters easier. When you register your copy of Surefire, you will receive a nicely bound printed Surefire User's Guide. This guide is loaded with illustrations and step-by-step practices and has a complete index for finding topics of interest quickly. Doing the practices will enable you to benefit the most from the unique capabilities of Surefire. In order that you can have a vision of what Surefire is about before you begin, we are going to introduce the notion of Smart Documents. The Smart Document is what makes Surefire unique. Surefire User's Guide Page 11 What is a Smart Document Normally, word processing features are used to edit and manipulate text. Once the text has been typed into your document, you could print it for yourself or others to read. But what if your document did some things for you automatically? Or better yet, what if you could interact with your document? Suppose you were writing a letter. Your letter would probably have your company letterhead and other information pertinent to you. However, every time you write another letter you need to check your calendar so that you can type the correct date. Having each new letter automatically start with today's date would let you spend more time putting your thoughts into your letter. Or, have you ever filled out a travel expense form at the end of a long week and found out that the figures did not add up? No matter how carefully you added the amounts, all of your daily totals did not equal all the totals for the weekly categories. Frustrating time-wasters like this can be eliminated if you could teach the computer to make these routine calculations. With Surefire, you can put intelligence into your textual documents. When you do this, you create Smart Documents. Surefire builds upon your knowledge of word processing to allow you to incorporate spreadsheet and database management features directly within your documents. A Smart Document can be a data entry or retrieval form, an expense report, a contact database, a profit and loss statement or a job estimate. In fact, a Smart Document can be almost any application for which a spreadsheet or database program is used. What's more, a Smart Document can contain "buttons" to perform specific actions. And, Smart documents can be linked together to build sophisticated custom applications. Automatically dating your letter and setting up an expense report are two simple examples of Smart documents. But Surefire's power and flexibility go far beyond that! On the following page is an example of two smart documents that could be part of a larger application. One of the documents is an organizational chart that shows the reporting hierarchy at a company. The other is an example of the phone list of all employees at that company. The phone list may be viewed by "pressing" a button on the ORG chart. In this case, pressing the "Full Directory" button will give the company phone list while pressing the "VP Marketing" button will display a list of all the employees reporting to Joan Lindle. A Smart Document can be used as a fill-in-the-blank form. Take a standard property lease for example. Generally, a lease has blank spaces which will eventually hold information such as the names of the tenant and landlord, the rent due each month and the required damage deposit. With Surefire, you could enter the standard text of the lease once and allow Surefire to quickly guide you through the blank areas to fill in Surefire User's Guide Page 12 the missing information each time a new lease is needed. In addition, this information can be stored so you can quickly find a lease for a particular tenant or all leases starting in a particular month. Perhaps you have trouble sorting your friends from your business associates in your little black address book, or perhaps you travel often for business or pleasure and would like to keep track of the best places to eat in various cities. A database would allow you to keep track of the information and would let you search through it in an easy manner. You may want to send different holiday cards to your friends than to your associates, or you may wish to look up restaurants by city or by cuisine. Any of these can be a Smart Document. Eventually, you may find that you have created a number of smart documents that each do a specific task. With Surefire, you can create a smart document that is a menu linking all of these other documents into one personalized application. The uses of Surefire's Smart Documents are almost limitless. As you will see, a smart document can become increasingly more intelligent by incorporating features one at a time to solve the task at hand. This manual will show you how to create useful Surefire documents and gradually add more and more intelligence to them. Chapter Preview Chapter 2 guides you through the steps to install and run Surefire. Chapters 3 through 9, show you how to get around in Surefire and how to use the word processing features. These features range from creating simple letters to manipulating more complicated documents. Chapter 10 shows you how to use Surefire's handy calculator. Chapters 11 through 15 show how to create Smart Documents that directly calculate information. Chapter 16 shows specifically how this applies to spreadsheets. Chapters 17 through 21 describe Surefire databases. You will see how Smart documents can store and retrieve many records of similar information. Chapter 19 tells you how you can access a database in many ways while Chapter 20 specifically shows you how to make forms and form letters. In Chapter 22 you will learn how to generate reports from a Surefire database, right in your document. Chapters 23 and 24 include more detail on using printers and managing Surefire documents. In addition, you will see how to import and export data between Surefire and other programs. Chapter 25 gives you more information about the Surefire system. This includes a discussion of backing up your files. Appendix A describes all of the functions that are available in Surefire to manipulate Surefire data. Surefire User's Guide Page 13 Chapter 2 - GETTING STARTED Before you install Surefire, you should be somewhat familiar with the DOS operating system and your particular hardware. You should know about the DOS directory structure, the type of disks drive(s) you have and the identifiers of these drives (i.e. A:, B:, C:, etc). Consult your DOS reference manual for complete information. After downloading surefire.zip onto your hard drive, and unpacking the Surefire files from it, be sure to run the Surefire demo. See the section "The Surefire Demo/Tutorial" at the end of this chapter for more information. You will see these files: The Surefire program (surefire.exe), the Surefire system help file, printer drivers and other miscellaneous files associated with the Surefire system. You will also have the files needed to run the Surefire Demo/Tutorial. You may put the Surefire directory in your path by updating your AUTOEXEC.BAT file so that the directory is in your PATH command. Read your DOS manual for directions on doing this. This will allow you to run Surefire from any directory. Running Surefire 1. Type SUREFIRE at the DOS prompt. If you have added the Surefire directory to your DOS path (in your autoexec.bat file) you will be able to run Surefire from any directory on your system. If you have not, you must change directory to the Surefire directory before running Surefire. Surefire will look in your default drive and directory for files and documents that you access. If you type the command: "SUREFIRE .", at the DOS prompt, Surefire will look in your current drive and directory for any files and ignore the defaults saved in the configuration file. See the discussion of current drive and directory under System Setup later in this chapter. 2. Press (Enter) This will run Surefire. You will see a copyright notice and then the initial Surefire screen. The screen appears with the Menu Bar/Status line at the top. Just below this line is the top portion of an empty standard 8 1/2 by 11 sheet of paper. This is a new document. You may move about anywhere in this document and immediately type in information. The document may then be printed or saved for later use. Surefire User's Guide Page 14 Running Surefire with a Document You may specify the name of a Surefire document that you want to be displayed immediately upon running Surefire. To do this, type SUREFIRE and a document name at the DOS prompt. Surefire will look for this document in your current DOS directory. Press (Enter). This will run Surefire. You will see a copyright notice and then the screen will appear with the first page of the previously saved document. Leaving Surefire You can leave or exit from Surefire by choosing "Exit" from the File menu or by pressing (ALT + X). You may not exit from Surefire if there are any windows or menus currently displayed. Surefire will display a message window to warn you if there is the possibility of data loss due to not saving your document changes. System Information System information is always available by choosing the option "Info..." from the File menu. The Info window shows the current version number of the system with a copyright notice. You will also see the current date and time (provided you have set the DOS system clock) and the amount of memory available for the document. System Setup You may define and modify general system parameters and hardware configuration information in the Setup window. This window is accessed by choosing the option " Setup..." from the File menu. It displays the current disk drive, the current working directory, the current printer and the current printer port. In addition, it lets Surefire know how to display information on your video device as well as the current settings of other document related parameters. After making the modifications desired, you can choose OK to have the settings be used for the current session only. If SAVE is chosen, the settings are used for the current session and subsequent sessions. Current Drive and Directory Any files you read or save will be put in the directory where Surefire was installed. You can change to another directory by changing the values for the current drive and directory in the Setup window. Specifying the drive and directory tells Surefire where to look for documents, text and data files when you do a Get, and where to put documents and files when you do a Save. To specify a drive, type in a letter (usually A,B,C,D or E) in the field to the right of the label "Drive:". You need not type in the colon ':' or slash '\'. To change the current directory, enter the full path of the desired directory in the field to the right of the label "Directory:". While a complete description of drives and directories is not necessary to use Surefire, you may wish to refer to your DOS reference manual for more information. Surefire User's Guide Page 15 Current Printer and Printer Port Specifying the printer type is done with the multiple choice button to the right of the text "Printer is". If you press the Zoom key (ALT+Z) when the cursor is on this button, Surefire will display the names of all available printer definitions. Specifying a printer here indicates to Surefire how to send information to the printer when you choose PRINT or SEARCH & PRINT in the Print window. The printer port refers to how and where your printer is physically connected to your computer. You will find a multiple choice button to the right of the text "on Port" that is used to indicate the printer port to Surefire. If you press the Zoom key (ALT+Z) when the cursor is on this button, Surefire will display the names of available ports. Please read "Chapter 23: More About Printing" in this manual, for a discussion about setting up printers. Using Your Display Depending on whether you have a monochrome or color monitor or the type of grey scale supported by your laptop or display monitor, you may choose the representation for how Surefire will appear on your display device. The possible display types are described as follows: Display Types Indication Default Automatically set for monochrome or color depending on your equipment. Color Indicates that the monitor is color. Grey Use for grey scale or color emulation. Inv Grey Similar to Grey but reversed for LCD displays. B & W Forces monochrome attributes on non-monochrome monitor. Note: If an incorrect display type is shown or you wish to change your display type, you must save the change, exit from Surefire and run Surefire again from the DOS prompt. If you have a computer that does color emulation on black and white monitors, you may want to try a few options to see what is most pleasing. This may be of particular interest if you are using a laptop or portable computer. If you have an LCD display, and the default display setting doesn't produce enough contrast, you should try the "Inv Grey" setting. Another option is to set your computer to emulate a monochrome monitor instead of color. Sometimes this can be done by using the "B & W" display option. Try it. If underlines are not displayed, you may need to set your computer hardware to monochrome emulation mode. This may not be available on some computers. Consult your computer manual for how to change its display modes. Surefire User's Guide Page 16 Document Related Parameters Any of the document related parameters shown in the table below can be changed for the current Surefire session or set for all subsequent sessions. To change any parameter but Tab Size, position the cursor over the appropriate Yes or No and press (Spacebar). Tab Size The Tab Size indicates where to put equally spaced tab stops. When you are editing a document and you press the (Tab) key, blank characters are inserted on the page from the current cursor position up to the next tab stop. You enter the number of characters to be between tab stops in the field to the right of the label "Tab Size:". Word Wrap Word Wrap is a mode that can be either on or off. When on, words that you type on a page of your document are automatically moved to the next line if there is not enough room on the current line. The value that you set here will be reflected in the Word Wrap menu item on the Page menu. Read "Chapter 4: Typing Text" for a complete discussion of Word Wrap. Auto Calc Auto Calc is a mode that can be either on or off. When on, Surefire will always calculate new field values whenever any field value changes. The value you set here will be reflected in the Auto Calc menu item on the Field menu. Read "Chapter 15: Using Field Commands" for a complete discussion of Auto Calc. Hints The response that you enter, in the field to the right of the label "Hints:" tells Surefire whether you want the Hint Line at the bottom of your screen to be displayed or not. The Hint Line shows the more important keystrokes that are available at any time during your Surefire session. This information changes depending upon whether there is an open Surefire window or menu. You may also decide to display or undisplay the Hint Line by pressing (Shift+F10). Below is an example of the hint line displayed when there are no open Surefire windows or menus. Auto Backup Auto Backup may be on or off. If on, Surefire will save a copy of your document before you save any changes. You may restore the previous version of your document from the copy if you wish. See "Chapter 25: Surefire System Topics" for a complete discussion of Backup and Recovery procedures. Surefire User's Guide Page 17 The Surefire Demo/Tutorial The quickest way to become familiar with Surefire is to see it and feel it. You can do this with minimal effort by running the Surefire demo/tutorial. You can view the demo/tutorial completely by just using the (Spacebar) key. In some places, you can use the same keys as in Surefire itself. The demo/tutorial will really get you excited about what you can do. You run the demo/tutorial by typing SFDEMO at the DOS prompt. The example documents described in the demo are available with the registered version of Surefire. These documents will help you build your own Smart Document applications. They include a basic lease manager, a contact manager and a company organization system. The on-line help specific to these example applications will provide a template for developing your own application help. Surefire User's Guide Page 18 Chapter 3 - GETTING AROUND In the spirit of making an easy-to-use program, we created Surefire with a custom window interface. Since Surefire doesn't require the memorization of hundreds of cryptic commands or overload you with too much information at once, you'll soon discover that Surefire's window system is a refreshing departure from other DOS applications. Surefire groups all of the same types of functions together in specialized windows. If you have seen other window systems before such as the Apple Macintosh or Microsoft Windows for the IBM PC, then you are already familiar with the basic concepts behind a window system. However, because Piaf designed a custom interface for Surefire, the interface has some unique features not seen anywhere else. Therefore, whether or not you've used window-based programs before, we recommend that you look over this chapter to familiarize yourself with Surefire's approach. The Document The document is carefully designed to provide you with a flexible environment perfectly suited for handling every aspect of document generation. For example, the word processing features found in the document are best used for manipulating text and dealing with formatting concerns, while the data management features give you complete control of how you want your data presented. The Page Display If you choose to start a new document, the screen shows you a representation of a standard 8 1/2 by 11 blank sheet of paper. This is the first page. The grey area represents the margin, and the blank space represents the writing area. Text is added to the page by typing, and it appears to the left of the cursor. If you make a mistake, using the backspace key will erase characters to the left of the cursor. To change the position of the cursor on the page, you use the arrow keys on your keyboard. On some PC, AT and XT keyboards you'll see separate arrow keys, while on others, you'll find them on the numerical keypad. Menus While a screen looks like a complete display, a menu or window looks like an independent display-within-a-display. Whenever you choose a command in a menu or window, you are telling Surefire exactly what you want it to do for you at the time. Menus give you a list of choices called menu items. The Menu Bar Menus are accessed from the menu bar. Because it is always visible, the menu bar provides you access to all menus at all times. This line also provides you with essential status information about what you are currently doing in Surefire. Surefire User's Guide Page 19 The Menu bar consists of seven menus (or pull-down windows): File, Page, Operate, Edit, Field, Data and Graphic. In this chapter, we will be using the File and Page menus in our examples. These and the other menus will be detailed fully in subsequent chapters. Choosing a Menu Item Follow these steps to choose a menu item: 1. Press (F10). The Menu bar is accessed by pressing function key (F10). This places the cursor on the word File. 2. Move the Cursor. Pressing the (right arrow) key will place the cursor at Page, and a (left arrow) from Page will return the cursor to File. 3. Open the File menu. Pressing the (down arrow) key at File will display the File menu. 4. Open the other menus. Use the (left or right arrow) keys to cycle through all 7 menus. 5. Cycle through the menu items. The (down arrow) will cycle through available choices and the (up arrow) will cycle in the reverse direction. 6. Select one of the menu items. When the cursor is over the desired choice, press (Enter) and some kind of action will be performed. For example, choose Get... in the File menu. 7. Close the window. When you choose Get..., a window appears asking for the name of the file that you want Surefire to load. Close the window by typing (Esc) for now. This will return the cursor to the document. If you chose "Get..." in the File menu, you were presented with a window that requested more information. For "Get..." and several other menu items, a window will appear when the choice is selected. However, in most instances, Surefire will simply perform an action in response to a menu item selection. For example, the choice "Add Page" on the Page menu appends a page to the current page of the document without bringing up a window. You can tell the difference between the two kinds of items if you see three dots "..." following the item. The dots indicate that choosing an item will open a window. Accelerated Menu Selection In addition to choosing menus from the Menu Bar, you can choose menus directly from the keyboard by pressing the (ALT) key with the appropriate highlighted or red-colored letter of the menu. For example, to quickly bring up the File menu, you type (ALT + F). Surefire User's Guide Page 20 Once you've opened a menu, you can also quickly choose an item. In our File menu example, you have two options for choosing the menu item 'New'; you could either move the cursor to the item and hit (Enter), or you could type the item's highlighted letter (N). Inactive Menu Items When a menu item is unavailable because it is inappropriate to the type of work you are doing at the time, it will not have a highlighted or red-colored letter, and cannot be selected. Shortcuts For the menu items which are frequently used, it may be bothersome to bring up a menu each time you want to access the choice. Therefore, shortcut keybindings are available for the commonly-used menu items. Shortcuts are special keystrokes which give you direct access to the desired menu item. If a menu item has a shortcut, the keystroke will be indicated on the menu to the right of the menu item. Windows As you saw in the Setup window in the previous chapter, some windows ask you to supply additional information. Other kinds of Surefire windows provide you with information or alert you to a possible problem. These are called message windows. Whenever a message window appears, its function is to request some kind of input that Surefire needs before proceeding, and thus, you must respond to it before you can do anything else in the program. When you look at a window, you will notice three kinds of items: informative text, areas for typing, and buttons. The typing area is called a data entry field. The words not associated with a data entry field are usually buttons and they come in two varieties: "action" and "multiple choice". Window Fields In Surefire, fields are areas found in windows and documents with some sort of assigned function. On color monitors, window fields are blue and document fields are green. On a monochrome monitor, all fields are underlined. When you move the cursor into a field, the area changes to a black background with white letters. Windows have four varieties of fields: data entry, action button, multiple choice button and logical choice button. You can easily determine which kind of window item you are looking at by using the following guidelines: Data Entry Fields: In windows, you type in data entry fields. You can easily identify them because they always follow informative text, and usually a colon. Surefire User's Guide Page 21 Action Buttons: Action buttons always preform an operation when you "press" them. They are displayed as uppercase words and, like all other window fields are blue or underlined. You always use these buttons when closing a window. Multiple Choice Buttons: All multiple choice buttons are capitalized lowercase words. They are used for setting options. All multiple choice buttons can be zoomed. Whenever you zoom a multiple choice button, you are presented with a list of choices for that button. Press (ALT+Z) to "zoom" a multiple choice button or (Spacebar) to cycle through values. Logical Choice Buttons: Logical choice buttons look like multiple choice buttons as they are also capitalized lowercase words. Unlike multiple choice buttons, logical choice buttons answer a Yes/No question, and are easily identified by the question mark in the informative text preceding them. Press (Spacebar) to change the value of a logical choice button. Moving Between Fields The simplest way to change the position of the cursor inside a window is to use the (Home) and (End) keys. (End) will move the cursor to the next item of interest in the same way your eye moves across the page when you are reading. That is from left-to-right and top-to-bottom. In contrast, the (Home) key moves in the opposite direction. Changing Logical and Multiple Choice Buttons To change a logical choice button from Yes to No or from No to Yes, you use the (Spacebar). Multiple choice buttons let you choose from a list of items. To operate a multiple choice button, you can either use (Spacebar) to scroll through all of the choices (as you did with the logical choice button); or you can "zoom" the button by pressing (ALT+Z). Whenever you use the zoom option, Surefire will display all of your choices for the button in a "pop-list". Choosing Action Buttons In contrast to the multiple choice buttons which are always displayed as lowercase words, all action buttons are uppercase and are used to perform an action when you "press" them. Action buttons are always used whenever you close a window. Most of the Surefire windows have an action button labeled OK and a button labeled CANCEL. The OK button is used to tell Surefire that you either want to go ahead with an operation or that the new settings shown in the window are correct. The CANCEL button tells Surefire to ignore all of the changes you've made in the window. For example, in the Get File window, OK tells Surefire to read the file whose name is given in the window, and CANCEL tells Surefire to forget about reading a file. To access these buttons you use the (Home) an (End) keys. You can use the shortcuts: (Ctrl + Enter) for OK and (Esc) for CANCEL to bypass having to use the corresponding action buttons. Surefire User's Guide Page 22 Getting Help Surefire has several forms of help. Help displays descriptions of procedures and commands so that you can complete your tasks without having to turn away from the screen. Some help information is always visible such as the information in the Status Line. If desired, you can display Hints (see below) for suggestions on which keys to press, and Context Help for more information on common commands and procedures. The Status Line The Status line is placed to the right of the Menu Bar on the top line of the screen. The Status line provides you with word processing and database information; the current document name; the current page, line; and column. It also lets you know what Surefire is doing from time to time with an operation indicator. The operation indicator is found on the right side of the status line and appears highlighted. It notifies you that an operation is taking a long time and tells you when it is finished. The meanings of some indicators are shown below: Indicator Meaning GETTING A document file is being loaded into Surefire. SAVING The changes in a document file are being saved. LOOKING A word is being looked for in the document. REPLACING A substitution of occurrences of a word by another word in the document is being processed. Hints Surefire uses Keybindings to help you perform operations and make choices easily and efficiently. Recall that when you wanted to use a menu, you typed (F10) to access the Menu Bar. Likewise, when you wanted to close a window, you typed (Esc) to return the cursor to the document page. So that you don't have to keep a mental record of all of the keybindings used in Surefire, we offer a help line at the bottom of the screen to show you a context-specific display of keybindings. Only the most common keybindings that are relevant for the current task are displayed. For example, the hint line for a window shows you that the (Home) and (End) keys are used to move around; the (Esc) key will cancel the window; and the keys: (Ctrl + Enter) will verify the window information. If you were to type (Esc) and return to the document, you would see only the keybindings and their contextual meaning appropriate to Surefire's word processing and data management features. After some experience with using Surefire, you may not need to see the keybindings all the time. The line showing the keybindings can be hidden by typing (Shift+F10). You can redisplay the line by typing (Shift+F10) again. Surefire User's Guide Page 23 Context Help When you need help with using a menu or window, you can receive it by displaying the menu or window and then pressing function key (F1). The (F1) key displays a Help window that briefly explains what can be done in that menu or window. Often, there is more help information than can be displayed in one screen. To show another help screen, use the arrow keys or the (Page Up) and (Page Down) keys. When you are finished, press (Esc) to close the Help window. When there are no open menus or windows, pressing (F1) provides you with the most general information about Surefire. Document Help Document help may be provided for specific Surefire documents. After you have created a document using Surefire, you may want to use the document as a complete application in itself and will want others in your business to use it. To provide your associates with help specific to your document, you can create your own help information. This help information, if provided, is obtained by pressing function key (F2). See the section "Specifying Document Help" in "Chapter 24: More About Surefire Documents", for information on providing document help for your documents. Surefire User's Guide Page 24 Chapter 4 - Typing Text This chapter will guide you through the first steps of word processing - getting your words on the screen and saving them in a file. Those of you who have used other word processors before and are acquainted with common word processing features such as word wrap, typeover and insert modes, this chapter can be used as an overview. Just browse through the step-by-steps to see how Surefire's approach compares with what you've used in the past. Once you've become familiar with the key concepts in this chapter, you'll have an adequate background for doing the more complicated editing and formatting operations described in later chapters. Word Processors -vs- Typewriters For those of you new to word processing, keep in mind that you don't have to learn anything new about typing in order to use Surefire. Although many typists think that keystroking feels more natural on an electric typewriter than on a computer keyboard, the fingering for each is almost exactly the same. This is because the keyboard for the IBM PC and their "clones" or "compatibles" was designed from the popular IBM Selectric. The extra keys on the main part of the IBM PC keyboard (Esc, Ctrl and Alt) are called "control keys". The name is slightly misleading because these keys don't control anything. Instead, they are used in conjunction with other keys to send commands or perform special functions. For example, pressing both the control key and the backspace key at the same time will erase a word, while pressing the backspace key alone will erase a single character. Therefore, the control keys make it possible for other keys to have more than one function. Another difference between the computer keyboard and a typewriter is the extra keys on the right and left sides of the main typing area. On most keyboards, on the right side has a numeric key pad. Often, the number keys double as cursor-control keys as well. If you have this kind of keyboard, a key called "Num Lock" will switch you between using the key pad for entering numbers and using it for cursor control. You will know which "mode" your keyboard is in if you see a light above the key pad. On most, when the light is on, the number keys are active, and when the light is off, the arrow keys are active. If your keyboard is of this variety, Surefire will operate more efficiently if you use these keys for cursor movement only, and use the main keyboard for entering numbers. Some of the more upscale keyboards keep the cursor-control keys separate from the numeric key pad, so you don't have to use the same keys for both. The function keys are found either to the left side or above the main set of keys. They are usually marked "F1", "F2", "F3". . . Keyboards with the function keys along the left edge usually have 10 function keys, while keyboards with the keys across the top have 12. Each key has a different meaning depending on whether you press the key alone or in combination with either the (ALT) or (Shift) control keys. Surefire User's Guide Page 25 For help on learning which keys to press when, look at the Hints displayed at the bottom of the screen for suggestions. You view Hints by pressing (Shift+F10). Pressing (Shift+F10) again will hide the Hints. Creating a New Document When you start Surefire for the first time, the screen displays a representation of the upper portion of a blank 8 1/2 x 11 sheet of paper. The cursor is the blinking horizontal line, and starts out in the upper left-hand corner of a new document. The grey area is the margin, and the blank space is the typing area. As you type on the keyboard, text is inserted to the left of the cursor as the cursor moves from left to right. If you make a mistake, the (Backspace) key will erase one character at a time to the left of the cursor. You can press (Enter) to move to the start of the next line. Saving Your Document When you're done typing, bring up the Save window from the File menu to save your text. Saving your file will store what you typed on a permanent medium such as a floppy or hard disk. Since you are saving the document for the first time, you will need to give it a name. In the "Name:" data entry field, type in any name up to eight characters. When you are done typing the name, press (Ctrl + Enter) to close the window. This will return the cursor to where you last were in your document. Your document's name is displayed on the status line and the text you typed remains on the screen after you save it so that you can continue working on it. It is a good idea to save your typing on disk about every 15 minutes or so. This ensures that your work will not be lost if the power goes out or you leave your computer unattended. Cursor Movement If Surefire forced you to start every page in the upper left-hand corner, and required you to erase all mistakes by backspacing, it wouldn't be a very useful program. Luckily, this isn't the case, as you can start typing anywhere on the page by moving the position of the cursor to the desired location. In addition, there are many other times when you'll want to move the cursor--when inserting, deleting, relocating text, and reformatting paragraphs--to name a few. In Surefire the cursor keys (arrow keys, Home, End, Page up and Page down) change your typing position, while the Spacebar, Tab, Enter and Backspace keys actually modify the text when pressed. For example, typing (Spacebar) will give you a blank character, while pressing (Right arrow) will move the cursor over one position on the screen without changing the text in any way. Pressing (Backspace) will erase a character, while pressing (Left arrow) will move the cursor over one space. Likewise, typing (Enter) will put the cursor at the beginning of the next line, but pressing (Down arrow) will move the cursor down one line while keeping the left-right orientation of the cursor the same. Surefire User's Guide Page 26 In this chapter we are concentrating on the basics of typing a simple document, so our discussion is limited to only what you need to know for making small changes while entering text. When you start doing major revisions in the next chapter, you'll encounter a complete presentation of the cursor keys in action. Entering Text One difference between entering text into a word processor and typing on a typewriter is that a word processor makes pressing (Enter) at the end of every line optional. The choice is based on whether you are typing while using automatic Word Wrap. Surefire's Word Wrap determines what happens when you reach the end of the line while typing text. When Word Wrap is off, you will find that Surefire operates like a typewriter because it will not let you type characters beyond the right margin. To continue typing, you can either press the (Enter) key or reposition the cursor using the arrow keys. In contrast, if you reach the end of the line when Word Wrap is on, you will be able to continue typing since the cursor automatically moves to the beginning of the next line. When in Insert mode, the word you are currently typing will also automatically jump down to the beginning of the next line along with the cursor. This means that if there is not enough room on the end of the line for a complete word to fit, Surefire will automatically move the last whole word you type to the beginning of the next line without you having to press (Enter). When entering text using Typeover mode while Word Wrap is on, only the cursor moves to the next line. For example, if you are entering a table where the last column is aligned flush right, you can start entering the next row without pressing (Enter). This is done by typing text or pressing the (Tab) key until the cursor automatically moves to the first character of the next line. As you can see, Word Wrap is a convenient feature. You no longer need to press the (Enter) key in anticipation that the word you are about to type will not fit on the line. With Word Wrap, your typing speed and concentration are greatly improved as you don't have to be constantly watching the screen to see where to type (Enter). Although Word Wrap makes typing paragraphs much easier, there are still many tasks for which Word Wrap is not suitable. Tables, letterheads, diagrams, charts, and forms are some examples of documents best done without Word Wrap. This is why Surefire gives you both modes. Surefire User's Guide Page 27 "Wrapped" and "Unwrapped" Paragraphs Whether you want to use Word Wrap while typing text or not, each paragraph you enter will be either "wrapped" or "unwrapped". In a "wrapped" paragraph, all the words are arranged to completely fill up each line. A line that is "unwrapped" has extra space on the right that could be "filled-in" with words "wrapped up" from the lines below it. In addition, entering or editing text in Insert mode with Word Wrap on automatically results in "wrapped" paragraphs. Sometimes you may want to "wrap" together "unwrapped" text. To force an "unwrapped" paragraph to become "wrapped", move the cursor to the end of the first line of the paragraph, press (ALT+W) until a 'W' is displayed in the status line to turn Wrap on, and then press (Delete). In Surefire, a paragraph is separated from the next paragraph by a blank line or a line that is indented at least one character from the left margin. An indented line also indicates the start of another paragraph. When you force an "unwrapped" paragraph to "wrap", the paragraph is reformatted up to the start of the next paragraph. Typeover and Insert modes Surefire gives you two modes for editing text, Typeover and Insert. As a general rule of thumb, Typeover mode is better suited for replacing text that is already there with something else. Insert mode is more appropriate for adding text to a line while retaining the text that is already on the line. Using Typeover Mode Whenever you type text in Typeover mode, all old characters vanish as you type new ones on top of them. Therefore, you can type directly on top of text, without having to worry about removing the characters underneath. This makes editing some documents such as forms and tables easy and convenient. There are times when you will want to type on top of a larger section of "wrapped" text. The best way is to remove the unwanted section of text and then insert the new text in Insert mode with Word Wrap on. You will learn how to edit text this way in "Chapter 5: Revising a Document". Using Insert Mode Correcting missing letters, spaces, words, or punctuation marks is simple in Insert mode: you merely position the cursor one character to the right of where you need to add text, and type the new text. As you type, the letters to the right are moved further to the right, to make room for the text you insert. Because of this, Insert mode is more suitable for "wrapped" text, but it will also work for "unwrapped" text if the amount of text is small. What happens at the end of the line depends on whether you are inserting while using Word Wrap mode or not. Surefire User's Guide Page 28 Word Wrap together with Insert mode allows for quick paragraph entry, while Typeover mode is best for typing forms, charts and tables. Keep in mind, that you can have both "wrapped" and "unwrapped" text in the same document, as in the example of a report with a "unwrapped" chart inserted between "wrapped" paragraphs. Depending on the kind of task you are doing in Surefire, you may want to stick to one mode, or use a combination. Deleting Characters It often happens that while typing a phrase, you think of a better phrase to use instead. Perhaps the first phrase is a little wordy or confusing, seems inappropriate at the time, or doesn't express your point directly enough. For times like these when you are deleting small amounts of text, you can use the (Backspace) and (Delete) keys or typeover text in Typeover mode. When you want to remove larger areas, you will need to use the other methods discussed in "Chapter 7: Clipboard Editing". Whenever you want to remove text to the left of the cursor, use the (Backspace) key. Whenever you want to remove text at the cursor, use (Delete). Keep in mind that deleting text gives you different results depending on whether you are working with Word Wrap or not. In Word Wrap mode, the words from the next line will move up to fill in the gap left by the deleted text. Otherwise, they will not. In addition, because Insert and Typeover modes only control how text is added to a document, (Backspace) and (Delete), work the same way whether you are in Insert or Typeover editing modes. Exiting Surefire To exit Surefire, press (ALT+X). When you exit you may see the following message: "Changes made to the current document not saved, Go ahead anyway?" If you see the above message, it is a reminder that you've changed your document since you last saved it, and those changes will be lost unless you deliberately save them. To save your changes before quitting, use (Esc) to close the message window, bring up the Save window by pressing (ALT+F) (S). When you see the Save window appear, press (Ctrl+Enter) to close the window and save the file. If you want your changes saved in a different file to keep them separate from the previous version, type a new filename in the "Name:" text entry field before closing the Save window. Surefire User's Guide Page 29 Chapter 5 - REVISING A DOCUMENT Now that you can use Surefire to type, insert and delete small amounts of text, you are ready to take advantage of Surefire's more sophisticated editing functions. If you examine the path you follow when you edit a document, you will discover that there's a well-defined process. The steps are remarkably simple, but often look complex when you are doing them, simply because you are in the middle of doing detailed work. This chapter will lead you through the basic steps of revising a document. Revising a document is how you'll spend many of your word processing hours. When effectively used, you'll find the editing techniques discussed in this chapter will liberate you from much of the drudgery of rewriting and free you to focus your mind--not on all of the technical details of grinding out words--but on the crucial, exacting process of effective communication. Opening a Document The first step of revising a document is opening the version you wish to edit. But before you can do this, you'll must locate the file. If the document is in a different directory than your current directory, you'll first use the Setup window to change the current directory. 1. Press (ALT+F) (E) to bring display the Setup window. Press (End) to move it to the "Directory:" entry field. Together, the "Drive:" and "Directory:" fields show your current "path". A path is the directions Surefire uses for locating document files. Initially, Surefire is looking in its home directory. Type the name of the appropriate directory here and press (Ctrl+Enter) to close the window and accept the new path. 2. Press (ALT+F) (G) to display the Get window. To display a list of all of the files in the current directory, press (ALT+Z). Use the arrow keys to scroll the list until the cursor is positioned on the right document. Press (Enter) and then (Ctrl+Enter) to close the "Get" window and load the document into Surefire. You should develop some kind of organizational system to manage all of your files. For example, you may want to group all of your letters in one subdirectory, sales documents in another, and proposals in a third. It doesn't really matter what system you use as long as you can quickly locate the file you need. For more information on organizing files, see "Chapter 24: More About Surefire Documents" found later in the manual. Surefire User's Guide Page 30 Printing a Document Now that you've opened your document, you're ready to see what it looks like on paper. However, before you can print, you'll need to make sure that your printer is ready, and Surefire knows the kind of printer you have and what port it is connected to. Preparation Before you print your first document in Surefire, you'll need to take these preliminary steps. Unless you change printers or have an unusual print job, you'll never need to do these steps again. 1. Check your hardware. Make sure that your printer is properly connected to your PC, has paper loaded, is plugged in, and is turned on. For additional information on printer setup, see "Chapter 2: Getting Started" and "Chapter 23: More About Printing". 2. Press (ALT+F) (E) to display the Setup window. 3. Move the cursor to the "Printer is" multiple choice button by pressing the (End) key twice. 4. Check the printer name. If your printer is different than the one displayed, continue to step 5. If your printer is the same continue to step 6. 5. Choose a printer. Zoom the button to see a list of supported printers by pressing (ALT+Z). Use the (up and down arrow) keys to move the cursor in the list. When the cursor lands on the name of your printer, press (Enter). If you don't see the name of your printer listed, choose the name of a printer that is compatible with your printer. You may need to refer to "Chapter 23: More About Printing" to choose the appropriate printer. 6. Choose a port. When you connected the printer to your PC, you did so via a printer cable. The printer port is the place on the back of the PC that is connected to the cable. Printer ports come in two varieties: parallel and serial. The type you use depends on whether you have a parallel or serial printer. For printing to work correctly, your printer and PC port must match, as a parallel printer will only work when plugged into a PC parallel port and a serial printer will only work with the associated PC serial port. If your printer can operate in either serial or parallel mode, you must tell your printer in some fashion which kind of port it is on the other end of the cable. Read your printer manual for this. If you know what port your printer is connected to, and it isn't the one displayed, bring up the list of possibilities by pressing (ALT+Z). Choose one of the ports in the list by using the (up and down arrow) keys to change the position of the cursor in the list. Press (Enter) to make your selection. If you don't know what port your printer is connected to, read the information in "Chapter 2: Getting Started" about hardware connections before continuing. Surefire User's Guide Page 31 7. Save the Setup configuration. Move the cursor to the "SAVE" action button by pressing (End). Press (Enter). This will close the Setup window and save your printer selections. Unless you change printers or ports, you will not have to prepare Surefire for printing again before printing. Printing Whenever you print, there are some considerations that you should keep in mind. What paper size you are using? What size characters do you want to print? How much space do you want for the margins? How long do you want to wait for it to print? How many copies? Which page do you want to start with? To make this easier, you should experiment with the default printer settings and formatting. If you don't like how the printout looks, you can adjust the settings to suit your own preferences. For information on customizing Surefire's formatting and printing settings, read "Chapter 9: Page Layout". Follow these basic steps to print a document: 1. Press (ALT+F) (P) to display the Print window. 2. Start printing. Normally the cursor is found on the "PRINT" action button when the window first comes up. Press (Enter) to begin printing. If the cursor is found somewhere else, press (End) or (Home) until the cursor is over "PRINT". 3. Notice the Print Message. If you are prepared to print, you should see the Print Message. It indicates that Surefire is sending information to the printer. 4. Notice that Surefire changes pages while printing. As the document prints, Surefire displays the page that is currently being sent to the printer. When all of the pages have been sent, the message disappears, and you see the last page of the document. 5. Not Printing? If you see the Print Message, but nothing happens even after waiting awhile, check the following: Your printer is not configured correctly, you have selected the wrong printer or port in the Setup window, or the cable is not connected correctly. Scrolling Whenever you revise a document, you usually start by scribbling corrections and comments in the margins of the paper copy. After you've decided which redundant sentence to omit, what word is too formal, and what paragraph is to be moved, the next step is usually scrolling through the text on the screen to locate the sections that need modification. Surefire User's Guide Page 32 To make locating text easier, you might find it helpful to mark the sections on the printed copy with a highlight marker so you can quickly glance at them while scrolling. Furthermore, if you are going to spend a lot of hours word processing, we recommend you use some kind of stand to hold your printed copy upright next to your computer screen. This saves time and prevents neck strain because you don't have to take your eyes off of the screen to look down. Attach a spring clip or clothes pin to the top of a clear plastic recipe book stand for a cheap and very effective copy holder. But what if your printer is like the Diablo 630 and takes four minutes to print a page, and you don't have time to wait that long after each revision? People with slower printers find it faster to review and revise their document at the same time in Surefire--scrolling and editing as they go. However, keep in mind that for many people, proofreading on the screen isn't as effective as proofreading a paper copy. When you can only view a third of the page at a time, it is easy to get a distorted perspective of your document because it is difficult to imagine what it reads like as a whole. In addition, for most people computer screens are harder to read and looking at them for hours at a time is a strain on their eyes. Therefore, if you want a refreshing vacation from looking at pixels, work with printed copies--but only if you have time to wait for the printer. Scrolling by Lines, Screens and Pages In the last chapter, you learned to move the cursor up and down the page one line at a time--an appropriate amount for entering text into a document. However, when you start editing a document, learning how to move around in much larger units is essential. In this section you will learn to move quickly from one part of the document to another so that you can easily locate the sections you want to edit. Think of your document as one long piece of electronic paper that stretches from one end to the other--something like the paper tape in an adding machine. Because your monitor will only display 25 lines, you can only view about a third of a page at a time. When you scroll, you view a different "screen", either above or below the last one viewed. As you advance (or back up) in the document by viewing sequential pieces of text, the "electronic paper" will seem to wind or unwind across your display. You can scroll by three amounts: lines, screens and pages. The size you use depends on how far what you want to see is from where you are, and how fast you want to get there. If you advance (scrolling forward) by lines by pressing the (down arrow) key, "new" lines will constantly be appearing on the bottom of the screen, and "old" ones will be disappearing off of the top. Likewise, scrolling backwards with the (up arrow) key reverses the movement, displaying "new" lines on the top, and moving the rest down to compensate. When you scroll by screens and pages, you move more quickly from one part of the document to another. Once you are familiar with the document, you can recognize where you are by reading snippets as they Surefire User's Guide Page 33 move past. You need to stop only when you feel you are close to the place you're looking for. Then you can scroll at a slower pace, and in smaller chunks. Scrolling to the next "screen" (23 or 24 lines of the electronic paper) is done by pressing (Page Down). Pressing (Page Up) will display the previous "screen". Whenever you press (Ctrl+Page Down), you display the first "screen" or first part of the next page. Likewise, (Ctrl+Page Up) displays the first "screen" on the previous page. In addition to using (up arrow), (Page Up) and (Ctrl+Page Up) to scroll backward, and (down arrow), (Page Down) and (Ctrl+Page Down) to scroll forward, you can also scroll to the beginning or end of the document by pressing (Ctrl+Home) or (Ctrl+End) respectively. Two Faces of Editing For those occasions when you are revising a document, you will find the "scroll and change" style of editing to be the most efficient way to get the job done. Likewise, whenever you are reorganizing, you will find "cut and paste" editing a real time saver. Since the focus of this chapter is using the "scroll and change" method of revising text, we are going to leave the exciting world of "cut and paste" to another chapter--"Chapter 7: Clipboard Editing". If at this point in time, you are more interested in learning about "cut and paste" editing, feel free to skip ahead, as you do not need to read the rest of this chapter before you can learn to do clipboard editing. "Scroll and Change" Editing Whenever you scroll through a document--reading and revising as you go--you make changes by adding or removing text. If you read the last chapter, "Chapter 4: Typing Text", then you already know the basics of moving the cursor around the screen and inserting, backspacing or deleting. However, if Surefire limited you to doing only what was discussed in that chapter, revising documents would be painfully slow. Luckily, there are several key commands that really speed things up, and these are discussed below. Moving the Cursor on the Screen Once you've located the screen you want to view, and you spot a sentence you want to change, you'll need to move the cursor into position before you can make any changes. As discussed in the last chapter, "Chapter 4: Typing Text", you move the cursor into position by pressing the cursor keys. For a summary of all of Surefire's cursor movement commands, survey the table on the next page: Surefire User's Guide Page 34 To Move Press Left one character Left arrow Right one character Right arrow Up one line Up arrow Down one line Down arrow Left one word Ctrl + Left Right one word Ctrl + Right Start of text on the line Home End of text on the line End Left margin Ctrl + (L) Right margin Ctrl + (R) Scroll backwards one screen Page Up Scroll forwards one screen Page Down Scroll backwards one page Ctrl + Page Up Scroll backwards on page Ctrl + Page Down Go to beginning of document Ctrl + Home Go to the end of document Ctrl + End Changing Text Once you've located the text that you want to change, and have moved the cursor into position, the next step is to remove the old and replace it with the new. Of course, in the cases where you are only adding text--tacking on a sentence at the end of a paragraph, adding an omitted word or phrase, adding a blank line to break a long paragraph into two paragraphs--you will not need to remove text. Simply, type the addition, inserting it in front of the cursor. Keep in mind that the methods Surefire affords for adding and removing text, vary depending on whether you are editing using Insert or Typeover mode and whether Word Wrap is on or off. Removing Text In the last chapter, you saw that the (Backspace) and (Delete) keys are used to remove text one character at a time. Surefire also offers several methods for removing text in addition to (Backspace) and (Delete). To delete the word under the cursor, you press (Ctrl+Backspace); to remove all the text on the line the cursor is currently on, you press (Ctrl+D); and to delete all the characters from the cursor to the end of the line, you press (Ctrl+E). As you might expect, when text is removed while Insert mode is on, the space that is left is "closed up". Therefore, whenever you delete words or characters you will notice that any text to the right of the cursor moves over to fill the gap. If Word Wrap is also on, words from the lines below may also "wrap up", preserving "wrapped" paragraph formatting. Likewise, when a line is deleted, all lines below it are moved up to fill in. This happens in any mode. Surefire User's Guide Page 35 Adding Text As discussed in the last chapter, the methods you choose to use for adding text may depend on whether text on the page is "wrapped" or not. When inserting text using Insert mode, you simply position the cursor one character to the right of where you want to insert text, and start typing. Surefire will automatically make room for each character as you type and rearrange the text to accommodate the addition while there is still room on the line. When Word Wrap is on, Surefire will also move words down to subsequent lines if necessary. You can add text in Typeover mode by either typing over blank areas or by replacing text that is already there. Keep in mind that Surefire never does any "automatic adjustments" for you in Typeover mode. Adding and Deleting Lines In addition to removing text, the (Delete) key can also be used to remove blank lines and join lines and paragraphs together. To remove blank lines you move the cursor to the beginning of the line, and press (Delete). To join two lines, you must be in Word Wrap mode. You move the cursor to the end of the first line and then press (Delete). The text on the next line will "wrap up". While (Delete) can be used to join two lines together, (Enter) can be used to break lines apart. Here, you simply position the cursor where you want the line to break and press (Enter). All of the text to the right of where you pressed (Enter) will be moved to the beginning of the next line. Use the same technique to "open" a line by positioning it on the first character of the line before pressing (Enter). You can insert a blank line between the current line and the one above the cursor by pressing (Ctrl+O). This is a convenient way to put a blank line between two lines of text, and unlike opening a line with (Enter) it works in any mode. Good Editing Practices You will repeat the basic revision process you've encountered in this chapter many times to polish an important document. Once again, reading through the hard-copy version of the document after each revision is essential. It's just too easy to miss things on the screen that absolutely yell at you from the printed page. In the next chapter, you will learn faster techniques for moving around in the document than scrolling screen-by-screen. Specifically, you will learn how to use the "Goto", "Find" and "Search and Replaces" commands. Surefire User's Guide Page 36 Chapter 6 - LOCATING TEXT There are two ways to locate text in a document. One you now know well--the laborious method of going to the beginning of the document and scrolling down page-by-page until you find the right spot. An easier alternative is using a combination of Surefire's "Goto", "Find" and "Find and Replace" operations to quickly move around in a document. This chapter is designed to help you learn how to utilize these operations to move through the document and edit text in the fastest and most efficient ways. In the first few sections we will explain how to use each feature. Later, we will illustrate ways to use the operations to create "Bookmarks", and correct spelling mistakes and punctuation errors. Finding Text Sometimes you know that a paragraph or sentence needs to be changed, but you don't know exactly where in the document it is. If you can remember some unique words that are found only in that sentence or paragraph, you can quickly locate it with Surefire's Find operations. Find searches from the cursor to the end of the document. Therefore, to search the whole document, you will need to start at the beginning. Find is good for locating all of the times you discuss a point, refer to a person, mention a date, time or price. To use Find, follow these steps: 1. Press (Ctrl+Home) to go to the beginning of the document. 2. Press (ALT+T) or select "Find..." from the Page menu. 3. Type your text. The Find window will appear with the cursor already in the "Search for:" data entry field so you don't have to move it into position before typing. 4. Choose NEXT. This will start Surefire searching for all occurrences of your text. After you have found the word, Surefire stores it away, and you can "replay" the search with either (Ctrl+P) to look backwards, or (Ctrl+N) to look forwards. This makes Find fast and efficient. When there are no more matches of your text in the document, a message will be displayed. Finding Capitalized and Whole Words If your word is 'product', by default Surefire will find both "product" and "products". Unless you specify that you want Surefire to search for "whole" words, it will find any occurrence of the target text whether or not it is embedded in longer words. To find only those occurrences that are distinct words, you "press" the "Part Word/Full Word" button in the Find window. To "press" the button, use the (Home) key to move the cursor to "Part Word". Press Surefire User's Guide Page 37 (Spacebar). This will change "Part Word" to "Full Word". Now choose NEXT or PREVIOUS to do your search. In addition to limiting Find to looking for whole words, you can ask it to find occurrences of text with the specified arrangement of uppercase or lowercase letters. For example, in our "announce" document, "Boxes" is used differently than "boxes". In this document, "Boxes" is always part of the company name, while "boxes" are what the company sells. You can tell Surefire to be more discriminating by first entering the correct case in the "Search for:" text entry field, and then "pressing" the "Any Case/Exact Case" button in the same way you did the "Part Word/Full Word" button. Using Goto While "Find" helps you quickly locate words and phrases, with Goto, you can move the cursor to any page in the document or to the beginning or end. Depending on where you want to go, this can be faster than Find. For example, the paragraph that you want to change may be near the bottom of the document. Instead of searching for all instances of a phrase, it can be faster to go directly to the bottom of the document and then scroll backward to the place you need to edit. To use Goto, you start by bringing up the Goto window by either choosing "Goto" on the Page menu or pressing (Alt+P) (G). When the window appears on the screen, tell Surefire where you want to go. If you want to jump to a page, type in the number in the "Page Number:" text entry field, and then press (Ctrl+Enter). If you want to jump to the beginning or end of the document, press (End) until the cursor lands on the "BEGINNING" or "END" action buttons. Press (Enter). If you chose to jump to a page or the beginning of the document, then the cursor will appear in the upper left-hand corner of the typing area, whereas if you chose to jump to the end, the cursor will appear in the lower left-hand corner of the last page in the document. If you want to bypass bringing up the Goto window when jumping to the beginning or end of the document, you can press either (Ctrl+Home) or (Ctrl+End). Using Replace While Find locates text for you, Replace gives you the ability to track down a target word or phrase, and substitute something else for it or even delete it by replacing it with nothing at all. You access the Replace window from the Page menu or use the shortcut, (ALT+R). After Surefire is done locating all of the occurrences of text it is looking for, and has either replaced them or skipped over them, it will tell you how many replacements it made and inform you that the replacement operation is completed. Surefire User's Guide Page 38 Like Find, Replace locates a specified group of characters that you enter in the "Search For:" field. When specifying what to search for, you can also direct Replace to find only the text that matches the combination of upper and lowercase text you typed, or find whole or partial words. However, instead of parking the cursor at the beginning of the located text, Replace lets you substitute it with whatever you entered in the "Replace With:" text entry field in the Replace window. In addition, you can choose to either verify each replacement or have Replace make the substitution throughout the entire document. Replace differs from Find in that it can only search forward (there is no equivalent to "PREVIOUS"). If you want to locate all occurrences of the text, you must start at the beginning of the document. One of the biggest advantages of Surefire's Replace operation is that you can have it verify changes before it makes them by choosing "ASK & REPLACE". After you close the Replace window, Surefire will locate the first occurrence of your text and select it on the screen. In addition, the "Ask & Replace" window will appear. On the left-hand side it shows you what it found and what you specified as the replacement. Press (End) to move the cursor to the "REPLACE" action button Press (Enter). This will make the substitution on the screen. "ASK & REPLACE" is necessary when searching for and replacing words that could be imbedded in other words. There are times when it is disadvantageous to search for whole words because you may want to replace some imbedded occurrences and not others. For example, suppose you were substituting all occurrences of "cash" with "dollars", and for some reason didn't want to set the Replace window "Part Word/Full Word" logical choice button to "Full Word". When looking for partial words, Surefire would also find "cash" in "cashier". If instead of using "ASK & REPLACE", you chose to use "REPLACE ALL", Surefire would have found each instance of "cash" and substituted in "dollars" for it. Therefore, "cashier" would become "dollarsier". To prevent problems like these, Surefire lets you choose to replace a word or skip over it in the "Ask & Replace" window. Now that you understand the general uses of Replace, Goto and Find, you're ready to see how they are used in specific situations. The remaining half of this chapter concentrates on practical uses of these operations such as creating Bookmarks, correcting spelling errors, and changing punctuation errors. Locating Text Using Bookmarks When revising documents, you'll often find yourself going on several editing tangents. For example, while you're editing a section on marketing strategies, you may start thinking about customer preferences. If customer preferences are discussed in another section, this often means jumping to that section, typing in your thoughts before you forget them, and then jumping back again to marketing strategies. Surefire User's Guide Page 39 Like paper bookmarks, creating "Bookmarks" in Surefire allows you to move quickly to another place in the document without loosing your place. Incidentally, using Bookmarks is not a technique unique to Surefire. It is often found as a built-in feature offered by many high-priced, dedicated, word processors. But, when you use the basic Find operation, you can get the same results in an integrated program like Surefire. To create a bookmark, all you need to do is to type a unique string of characters (such as "**") on a blank line near the text you are currently editing. Then, search either backwards or forwards for a word or short phrase you know is found near some other place you want to locate. When the Find operation locates the target spot, simply type the same characters as you used for the other Bookmark on a blank line nearby. Now you can zip back and forth between the two Bookmarks by searching forwards or backwards for the unique string. When you're done using the Bookmark, "search and destroy" it using Replace. The mechanics of using Bookmarks are easy and intuitive. To search for your Bookmark in Surefire, simply press (ALT+T) to bring up the Find window. In the "Search for:" text entry field type your bookmark string. Then press (End) either once or twice to position the cursor on "NEXT" or "PREVIOUS" depending on whether you want to search to the end of the document or back to the beginning. As you learned earlier in this chapter, the next time you want to search for the Bookmark, you can do so without bringing up the Find window. You simply press either (Ctrl+N) to find the next Bookmark, or (Ctrl+P) to find the previous one. When you want to remove Bookmarks so that they're not printed in a final draft, you eliminate them by using Replace. To do this, bring up the Replace window by pressing (ALT+R). In the "Search for:" text entry field, type the unique string identifying the Bookmark. Then, press (End) to move to the REPLACE ALL action button (the "Replace With:" field will be left blank). Press (Enter) to close the window, and Surefire will remove the Bookmarks. If you find using Bookmarks to be well suited to the way you think, you may want to develop a Bookmarking system. To move among several locations in the text, you can develop a numbering system for the Bookmarks. For example, if you find "**" exceptionally appealing, you base a system on it such as "**1", **2, **3, or "**", "***", "****". For really complex documents, you may want to use a variety of unique strings for Bookmarks--such as "**", "XX", "%%", and "##"--to designate different Bookmarks for different chores. For example, in a report, "**" could mark all of the places where you discuss marketing strategies, while "XX" could identify places where you examine consumer preferences. If a system like this is appropriate for the document you're writing, be sure to include a list at the beginning of the document so that you won't forget what each Bookmark stands for. Surefire User's Guide Page 40 Correcting Spelling Errors Using Replace Luckily, once you've spotted spelling errors, either on the screen or on a hard copy, you can easily correct them in Surefire. For example, let's suppose you have misspelled a name. You'd have Surefire automatically search for every occasion you typed "Mr. Gresham" instead of "Mr. Gershom", and make the substitution. Therefore, there's no need to bother with locating and correcting spelling errors on-screen. Once you've discovered a misspelled word, Surefire will locate and correct all occurrences for you. Remember that Replace locates and corrects all occurrences between the cursor and the end of the document. So to correct the entire document, first move the cursor to the beginning of the document by pressing (Ctrl+Home). To correct your misspellings, bring up the Replace window from the Page menu; type the misspelled word in the "Search for:" text entry field; and then type the correctly spelled word in the "Replace with:" text entry field. Use (Home) and (End) to move between the text entry fields. When both words are entered, press (End) to move to the "REPLACE ALL" action button and then press (Enter). Surefire will then make the substitutions. One method of preventing misspellings of important names and places is to keep Replace in mind while you are entering text into a document. For example, let's imagine that you're writing a proposal to expand the Albuquerque Municipal Water System and Sewage Treatment Facility. Instead of typing "Albuquerque" 26 times, you could just type a unique sequence of characters such as "AAAA" each time you want to use the name. After the text is entered, use Replace to substitute all AAAA's with "Albuquerque". This way, you only type the name accurately once. In addition to using Replace for correcting spelling errors, it is useful for finding and changing many things that are hard to find (or don't want to find) by eye by manually scrolling through a document. Examples are dollar amounts, dates, times, extra spaces, missing spaces, voice (they, we, I, you), pet words, etc. Surefire User's Guide Page 41 Chapter 7 - CLIPBOARD EDITING The Clipboard In Surefire, as in most modern word processors, the Clipboard is simply a way to think of a place in memory that stores selected pieces of your document. Like a real clipboard, its function is to hold things until they are used elsewhere. Like many things which are just places in memory, you can't see the Clipboard, although you can see the objects it stores. For example, if you Cut a piece of text to the Clipboard, the text is removed from its former place in the document and is stored in the Clipboard memory exactly as it was displayed on the screen. Whenever you Cut or Copy something to the Clipboard, you will see this piece highlighted on the screen and displayed as an object. Once a piece of text becomes a Clipboard object, you can place it anywhere inside the margins of the document. To do this, you simply "paste" it. Unlike other software programs where you can store only one object on the Clipboard at a time, Surefire allows you to store any number. This way, if you add a new object, the old one is still around. This prevents you from loosing the last thing you Cut, and allows you to Cut or Copy multiple objects from the same page where they wait for relocation until you're ready to use them on another page or into another document. This aspect of Surefire's word processor makes it behave more like a desk-top publishing program than a simple word processor. In the following sections, we will describe in detail the mechanics of using each Clipboard operation--Block Select, Line Select, Cut, Copy, Paste, and Paste & Keep. We will discuss Delete since it shares the same techniques with Clipboard editing operations, even though it doesn't use the Clipboard. Clipboard Commands In Surefire, the mechanics of "cut-and-paste" editing are easy and intuitive: you first select the piece of text you want to relocate, and then choose either Cut or Copy from the Editing menu (ALT+E). Both Cut and Copy replicate the text you selected into a space in the computer's memory called the Clipboard. The replica is called a Clipboard object. Cut differs from Copy in that Cut removes the selected text from the document when the clipboard replica is made, while Copy leaves the selected text where it is. Delete acts like Cut but it doesn't make a replica on the Clipboard. Instead the text vanishes from the document, and can be recovered by using Undelete as discussed in Chapter 5. After you have Cut an object to the Clipboard, you can "paste" it back into the document once you've located where in the document you want to put it. To do this, you execute Paste, and Surefire takes the replica off of the clipboard and puts it back into the document in the new location. Paste & Keep acts just like Paste except that the Clipboard object remains on the Clipboard after pasting. Surefire User's Guide Page 42 Selecting Text Before you can Cut or Copy a piece of text, you'll have to specify to Surefire which piece of text to Cut or Copy. You do this by selecting it. Surefire has two methods of selecting text: Block Select and Line Select. Block Select -vs- Line Select You decide whether to use Block Select or Line Select by looking at the nature of the text you are selecting. The general guideline is to use Block Select for tables, charts and forms and Line Select for sentences and paragraphs. In addition, the method you choose also depends on what you want to happen when the text is pasted at a later time. When you paste Block selected text, it overwrites what is underneath it; whereas, when you paste Line selected text, it is inserted into the existing text. Just as its name implies, Block Select selects a rectangular area. always starting in the upper left-hand corner of the area you want to select, and always including the character under the cursor. Block select is ideal for manipulating forms and tables. For example, if you wanted to interchange two columns of a table, you would choose to use Block select. The largest block you can select is a page. In contrast, Line Select gives you the ability to select all the text between two specified points. Therefore, you can select any text in the document including several words, a phrase, sentences, paragraphs, or even several pages. Selecting a Region With Block Select Move the cursor to the upper left corner of the block to be selected. Choose Block Select from the Edit menu or press (ALT+B) to mark the starting point for the selection. When the beginning of a selection is marked in this fashion, it will become highlighted. Using the (down and right arrow) keys, move the cursor to the bottom right corner of the area you want selected. As you do this, you will see the screen highlight all the text in a rectangle between the starting point of the block and the present location of the cursor. When you have the desired rectangle highlighted, you have selected the block. When you select a block, Surefire expects you to do something with it. You can cut, copy or delete it. Each of these operations are available on the Edit menu. Cut (ALT+F1) removes the Block from its present location and puts a replica on a Clipboard. If you chose to use Copy (ALT+F2), it also puts a replica on the Clipboard, but keeps the selected area where it is in the document. Delete (ALT+E) (D) obliterates the Block from the document without making a replica. Surefire User's Guide Page 43 Cut (ALT+F1) is the best choice to move text from one area in the document to another. Once the Block has been Cut, you will see it displayed as a Clipboard object on the screen. The cursor will be inside the object, and you will be able to move the object around the screen using the arrow keys. To return the cursor to the document, press (F6). This "hides" the Block selected Clipboard object. You will see how to Paste a block later in this chapter. Cutting Block selected text will always leave white space behind just as if you typed in rows of Spacebar characters in Typeover mode. In contrast, cutting Line selected text results in having the text below the cut "wrap up" to fill in the hole. Selecting Sentences With Line Select To make a line selection, always start in the upper left-hand corner of the area you want to select. The selection includes the character under the cursor. Press (ALT+L) or choose Line Select from the Edit menu to mark this character as the starting point for the selection. By pressing the (down arrow), (Ctrl + right arrow) and (left arrow) keys, move the cursor to the period at the end of a sentence. As you do this, you will see the screen highlight all the text between the starting point of the selection and the present location of the cursor. When you are at the period, you have selected the sentence. Keep in mind that with Line select, once you have moved the cursor one line below the starting point, you can move the cursor either right or left. As with Block select, once you've selected a piece of text, Surefire expects a Cut, Copy or Delete command to follow. So, don't choose Delete. Instead, use Cut or Copy and a Clipboard object will appear on the screen. The cursor will be inside the object, and you will be able to move the object around the screen using the arrow keys. Return the cursor to the document by pressing (F6). Note: When using Line select to select short line paragraphs (e.g. lists), you must turn Wrap off to preserve the formatting of the lists. See "Chapter 9: Page Layout" for more information on paragraphs. Return to Normal Operations In addition to having a chance to compare how selecting text using Line select differs from selecting rectangular regions with Block select, you also learned how to view and hide objects on the screen. Surefire requires you to hide objects before you can do normal operations in the document such as typing and scrolling. To do this, press (F6). To view the Clipboard object again, press (F6) again. Surefire User's Guide Page 44 Canceling a Selection Sometimes you may change your mind and want to cancel your selection. Just as with canceling other Surefire operations, you simply press (Esc). In addition, we recommend that you choose to view the "Hints" at the bottom of the screen for help with remembering what keys to press while doing Clipboard editing, as many of the operations are not available from a menu. To view the "Hints", press (Shift+F10). Viewing Clipboard Objects As you saw in the previous section, selected text and rectangular regions become Clipboard objects when you Cut or Copy them. An easy way to understand exactly what happens when objects are Cut or Copied to Surefire's imaginary Clipboard is to think about a real clipboard. Lets suppose that our real clipboard holds all of the pages of our document. On top of the pages, let's pretend that we've overlaid a clear plastic sheet--perhaps something made for an overhead projector. Now, imagine that you stuck several yellow notes from a "Post-it" pad all over the plastic sheet. These particular yellow notes have clippings of text on them. Remember that the "Post-it" notes are obviously not part of the document text. You can see this clearly because the notes obstruct from view the text underneath them and are a different color. In addition, they can easily be moved around by "sticking" and "unsticking" them, while the document text remains fixed to the page. Now in our real-world clipboard situation, what do you do if you want see a different page underneath the clear plastic sheet? You simply remove the plastic sheet and shuffle the other document pages until you see the page you want. Only after the page you want is in view, can you replace the clear plastic sheet to see the notes again. To do this, you simply put the plastic sheet back on top of the pile. As you've probably gathered, the behavior of the Surefire Clipboard is almost exactly the same as our real one. The only difference between them is that Surefire's Clipboard is only the clear plastic sheet and notes. In Surefire, the document memory is kept separate from the Clipboard memory, although they both can be displayed simultaneously on the screen. Remember that Surefire's word processor uses three distinct memory spaces: the on-screen copy of the file (document), a delete buffer (for undeleting deleted text) and the Clipboard. Each of these are independent of each other, and the only time they interact is when you deliberately ask them to do so by using some kind of interactive command. As you continue to use Surefire, this distinction will become more and more obvious. When your Clipboard Objects are hidden, you can press (Shift+F6) to all of the objects at the same time. You may press (Shift+Tab) to move the cursor from one object to the other. Move the object with the cursor around on the screen by pressing the arrow keys. Press (Shift+Tab) again to move the cursor to another object. Notice that the object with the cursor may appear brighter than the others. Surefire User's Guide Page 45 To hide one object while viewing the others, press (Tab). This will cause the cursor to move between each of the other objects and gradually cause all but one of the objects to disappear. To view and return the cursor to the first object, keep pressing (Tab). When you press (F6) to return the cursor to the document, all of the Clipboard objects will be hidden once more. Copying Text Perhaps the most frequently used Clipboard operation is Copy. Whenever you copy a piece of text to another location in Surefire, you put a replica of a piece of text on the Clipboard while leaving the original where it is in the document. When you locate the new place you want the copied object to go, you either use Paste or Paste & Keep. The most commonly copied text items are long phrases or names that are often repeated. For example, if you are writing a proposal to expand a sewage disposal plant, instead of typing "Albuquerque Municipal Water System and Sewage Treatment Facility" 26 times, just type it once, copy it to the Clipboard, and paste it 25 times! Therefore, if you find yourself repeating any line of text more than a couple of times, rather than retype, just select the text using Line select and Copy it. When you find the right spot to insert it, Paste it. In addition, since you can Copy a piece of text, you can compare how the block or line reads in its new location compared to the old location. Exercise some caution with this, however. If you copy and relocate a larger block of text, it appears in the document in both places. If the original block isn't removed later, it will still be in both places, and when reading over the manuscript you may not notice the repeated section if the instances are far enough apart. However, if the person reading your document is skimming through it quickly, he may say to himself, "Didn't he just say that?". Therefore, after you compare, make sure that you delete one of the copies so that you don't inadvertently repeat the same thing twice or more, in exactly the same way in different parts of your document. Moving Text While copying text is the most common Clipboard operation, moving text is the safest. Because there is always one copy of a paragraph in the document, you avoid the "reproducing rabbit" syndrome sometimes found in documents where copying is excessive. With move, you can always return your text to its original position if you don't like the new lineup. So choose to move text if you're trying out material in a different order. If it's gone from the first location, you can always get it back by moving it again. And it won't embarrass you like rabbit fever can. The major function associated with moving is "parking". When you are writing paragraphs you often remember something that you haven't discussed, or need to discuss in another place. Instead of loosing your train of thought, you simply designate a place to "park" your tangents. Surefire User's Guide Page 46 It is also a good idea to "park" text that "just doesn't fit" in the sections you are currently writing. If the misfit text is important and needs to be addressed, you'll find a more appropriate place for it later. Instead of deleting it, just "park" it. Setting the last page of the document aside for stray text is a common approach to "parking". This way you can have a safe place to store text without affecting anything else in the document--like page numbering. And the page is saved along with the rest of your document. You can name this page "Asides" or "Afterthoughts" with a Bookmark to make it easy to locate with "Find". This will help if your document keeps growing, and you don't want to keep track of the new page numbers. When you combine "parking text" with the "Book marking" technique discussed in the last chapter, you can easily move between the Asides and the paragraph you are currently working on. After you find a place for the "parked" text in the document, you can easily locate it and zip it out of its "parked" location and move it anywhere in the document using Cut or Copy and Paste. If you will be parking a lot of text, add a New Page, with a page stop before it, at the end of your document. To do this, go to the end of the document and choose "Add Page" from the Page menu. Move the cursor upward to the line below the bottom margin of the previous page that shows you where the page ends. Press (Spacebar). You will see a "STOP" displayed. A page stop (or hard page break) prevents text which is added on previous pages, from being wrapped onto this one. Press (F6) to bring a previously Cut or Copied Clipboard object into view. Position the object in between the margins by pressing the arrow keys. Paste the object by pressing (ALT+F3). The text has been successfully "parked". You move text by simply Cutting it to the Clipboard and then Pasting it from the Clipboard in the desired location. Unlike, Copy, the selected text in the document is not retained, but is removed in the same fashion as if it were deleted. Keep in mind that with Cut (as with Delete), the results of the Cut operation are different depending on whether you used Block select or Line select to select the text. Pasting Text Before pasting a Clipboard object, move the cursor to the location where the text will be inserted. The Paste operation will place the object in the document differently depending on how it was selected. Therefore if you are editing "wrapped" text, and used Block select, the results of pasting the Clipboard object will be the same as if you typed the text using Typeover mode. When you paste the Block, it retains its same shape. If you've selected text using Block select, it is important that there is enough blank space for the Clipboard object before you paste, or the operation will obliterate existing text (and Undelete will not Surefire User's Guide Page 47 undo this kind of deletion). There are times when this is what you want to do, but as a rule, you probably will want to make sure that there is enough room first. Also, if the object is not contained between the margins, you will see a message when you try to paste. Block selected objects must be completely contained in the typing area. As long as you don't position the object in a margin and there is no conflict with any fields (see "Chapter 11: Introduction to Fields"), there will always be room for Line Selected text, memory allowing. If a piece of "wrapped" text was selected using Line select, it will be incorporated into the existing text when pasted as if you entered it using Insert mode. If you are in Word Wrap mode, the text is "wrapped into" the document. If Word Wrap is not on, text is inserted line by line and is not wrapped together. Choose "Paste" from the Edit menu or press (ALT+F3) to Paste a Clipboard object. After you Paste the object, the previously displayed one will be displayed because it is now "on top of the pile". To hide it and return the cursor to the document, press (F6). Paste & Keep In contrast to Paste, Paste & Keep will retain a copy of the Clipboard object even after it is pasted, and functions as the "rubber-stamp" approach to "cut-and-paste" editing. If you keep using a long phrase like , "Albuquerque Municipal Water Storage and Sewage Treatment Facility", just use Paste & Keep instead of Paste to retain a copy of the object on the Clipboard after every insert. Choose "Paste & Keep" from the Edit menu or press (ALT+F4) to Paste & Keep a Clipboard object. Notice that there are now two copies of the text displayed on the screen. One is now part of the document and one is a Clipboard object. To return the cursor to the document, press (F6) to hide the Clipboard object. Sizing Clipboard Objects Whenever you Cut or Copy selected text to the Clipboard, the viewable portion of the object is set to be the first 12 lines of larger objects. This gives you a context to know what the object contains without having the object occupy too much of the screen. There are times when you will resize the object to view other than 12 lines. For example, let's suppose that you had several Clipboard objects each the size of a paragraph. In this case, you are using the Clipboard as a means to help you create a mock "outline" so that you can experiment with different sequences of these paragraphs and determine the order that is the most effective. When creating your "outline" it would be preferable to reduce the size of the object to just the one or two sentences. Then you can rearrange the objects on the screen, determine the best order, and then paste them one-by-one into the document starting with the one you have decided will be first. Using the Clipboard in this manner turns out to be a very efficient way to reorganize the content of letters, reports and proposals. Surefire User's Guide Page 48 Another time you'll want to resize your object is when you have more text in an object than what is displayed. For times like these, you can always make the object larger. Keep in mind that when you resize a Clipboard object, what is stored in the object remains the same--only the viewable portion is changed. Once the Clipboard object is visible, follow these steps: 1. Press (Shift+F3). This tells Surefire that you want to resize the object. The cursor will move to the lower right-hand corner of the object. 2. Press (up arrow). The object will keep shrinking until it is one-line tall. 3. Press (down arrow). The object will expand to its original size. 4. Press (right arrow). Nothing happens. This is because the object is already as wide as its original size. 5. Press (left arrow). The object shrinks in width. Now press (right arrow) to expand the object. 6. Return the cursor to its normal Clipboard object behavior. Press (Shift+F1) to return the cursor to the upper left-hand portion of the object. The object can be moved around on the screen again. 7. Press (F6) to return the cursor to the document. Often more information will be Cut or Copied to the Clipboard than what is initially viewed in the object. Cases like whole pages are good examples. In these cases, you may not want to resize the object, but instead may want to scroll it and view its contents in smaller portions. You do this by pressing (Shift+F2). This will put the cursor in the middle of the object, indicating that you want to scroll. Now you can use the cursor keys to view all of the information in the object. To be able to move the object again, press (Shift+F1). Removing Text In Surefire there are many ways to remove text. Some you have already seen in the last chapter--"search and destroy" with "Find and Replace", pressing either the delete or backspace keys, delete to end of line or delete the whole line. You can also remove text by changing your keyboard from Insert to Typeover mode and watching all previous characters vanish as you type over them. In addition, you can select text, Cut it to the Clipboard and then not put it anywhere. The last alternative is the topic of this section--you can select text and then delete it outright. Surefire User's Guide Page 49 Although potentially dangerous, select and delete is a useful function. It is best used for times you have writing experiments that don't work, redundant sentences and rambling prose. It helps you keep things concise and clean up a cluttered manuscript. In Surefire, deleting text is simple: just select text using Block select or Line select and choose Delete from the Edit menu. Keep in mind that with Delete (as with Cut), the selection method you use gives you different results when you remove text. Deleting Block selected text will leave white space behind just as if you typed in lines of spacebar characters in Typeover mode. In contrast, deleting Line selected text results in having the text below the deletion "wrap up" to fill in the hole. Recovering Text With all of these convenient ways to eliminate text from you document, it's important to know all the ways you can get it back if you delete too much or you simply change your mind. As you know, being able to delete a block can be a potentially disastrous capability. You can accidentally or thoughtlessly press the wrong keys. Or you could change your mind after deleting a lot of text, what do you do then? If the delete was the last one you did then you're alright. Simply press Undelete (F5). This will recall the piece from the "delete buffer" and return it to your document in the same place it was before. But if you delete the important text awhile ago, and have since deleted other things, then you can't resort to Undelete. If the lost text was part of your original document, you're still alright. You could just reopen your original version. But, if you made a lot of beneficial changes since disaster struck, you will be loosing those as well as recovering the deleted text. This could mean you'd be sacrificing a lot more than you'd gain. Another alternative is to save the on-screen document to a different file so that your beneficial changes are preserved. Now reopen the original document and recover the lost piece. Once you have the original document on your screen, select the piece, copy it to the Clipboard and hide the Clipboard by pressing (F6). Recall the version you were working on (and have since saved as a different file). Show the Clipboard again by pressing (F6) and paste the lost material. Surefire User's Guide Page 50 Chapter 8 - ADDING EMPHASIS All documents have a purpose. Business documents are written to inform, influence, persuade or convince the reader to do something or think something. You might write a letter to persuade a person to buy your product or support your organization. Or you might write a report to inform your investors that you are increasing your market share. Whatever the purpose, documents that are effective in accomplishing these goals are always clearly written and easy to understand. The easiest way to use Surefire to improve the effectiveness of a document is to take advantage of its graphical capabilities. By using its graphical features you can add emphasis to text and organize your thoughts to make your point more clear and convincing. You can support your conclusions with tables and graphs that effectively illustrate your data. When used effectively, these elements help to guide your readers through your printed thoughts, making it easier for them to agree with your position, give you the job or buy your product. This chapter explains how to use Surefire's graphical features. Specifically you are going to learn how to emphasize text, use special characters, indent paragraphs, draw boxes and lines, and construct tables and graphs. Character Attributes There are two methods Surefire offers for adding emphasis to text: drawing boxes around paragraphs to make them stand out, or having the characters themselves stand out by either capitalizing them or giving them attributes. Attributes are the distinctive elements added to selected characters to make them look different than the rest. In Surefire, you can make text bold, underlined or both. Make words bold when you want to emphasize them inside a paragraph. These are words that you don't want the reader to miss. Defined terms are good candidates for boldfacing. Underlined words are also commonly found inside paragraphs. In contrast to bold words, these words are "loud" and are used to remove any doubt from the reader's mind that this is important. A good example is: "this does not mean that we are going to support the project." Making a word both underlined and bold is usually too loud for words inside a paragraph but is excellent for emphasizing headlines and subheadings. In order to make the best use of emphasis in headings and subheadings, you should develop a consistent system for assigning attributes to them. Both headlines and subheadings should be clear and readable. If your document lends itself to subheadings, use them to your advantage. Surefire User's Guide Page 51 Giving a Character Attribute to Text To give a character attribute, select the text first using either Block or Line Selection. When the desired text is highlighted, you can apply Bold, Underline or both Bold and Underline attributes to your text. Bring up the Graphic menu by pressing (ALT+G). Move the cursor to one of the attribute types such as "Bold & Underline" and press (Enter). If you have a monochrome monitor, notice that the text is displayed as it would be printed. On a color monitor, notice that the text becomes blue while the background becomes green. If you had chosen "Underline", on a color monitor, notice that the background of the text is green. If you change your mind about making text bold or underlined, you can return it to its natural state by first selecting it and then choosing "Normal" from the Graphic menu. Special Characters For the times when you are using foreign words, mathematical symbols, fun symbols or special graphical elements such as characters to join lines and boxes, you will be using special characters. These characters are available from the Special Characters window from the Graphic menu. They are grouped by type and you choose them by positioning the cursor over one of them and pressing (Enter). Once a character has been chosen, you can access it without bringing up the menu by pressing (Ctrl+S). This inserts the previously selected special character into your text in the same manner as if you just selected it from the window. The Special Character window is shown below. Surefire is intended to be used for English documents and foreign characters are available when you need to add a foreign word to an English document. Indenting Lines and Paragraphs Another way to set off text visually on the page is by indenting it. It makes it interesting and gives the reader an idea about the relative importance of the text he is reading. The first lines of paragraphs are the most commonly indented text. To do this, you simply type (Tab) before entering text for a paragraph. If you have already entered the text for a paragraph and find later that you want to indent the first line, move the cursor to the beginning of the line and insert a (Tab). With Word Wrap on, the rest of the paragraph will adapt to the adjustment by reflowing. Otherwise, it will shift if there is enough space on the line to accommodate the inserted characters. If you find that you want to indent a whole paragraph, simply add tabs to the beginnings of all of the lines. If you have already entered the text, you can also indent the paragraph. In this case, it is Surefire User's Guide Page 52 important to start at the top of the paragraph and then work your way down the left-hand margin, indenting all of the lines one-by-one. Otherwise, the paragraph may not flow correctly. The standard or default size for a tab is five characters. If you wanted to change this to a different size, you'd need to change the tab size in the Setup window. To do this, bring up the Setup window from the File menu by pressing (ALT+F), (E). The Setup window will appear. Use the (End) key to move the cursor to the "Tab Size:" text entry field and type in the new value. When you are done, press (Ctrl+Enter) to close the window and change the tab size of the tabs you will type in the future. Keep in mind that this will not change previously typed tab sizes. If you want the new tab size to become the default, then instead of pressing (Ctrl+Enter), move the cursor to the "SAVE" action button and press (Enter) to close the window and change the tab size. Drawing Boxes and Lines Drawing Boxes and Lines to emphasize text is easy to do in Surefire. Horizontal lines are drawn from left-to-right. You simply position the cursor at where you want the line to start on the left, choose a style of line in the Graphic menu and then move the cursor to the right until the line is the desired length. Now, press (Enter). When you draw a vertical line, you do the same except in this case, you move the cursor from top to bottom and press (Enter). When you draw a box, you also draw it from left-to-right and top-to-bottom. You start in the upper left-hand corner of the box, choose a line style, move the cursor to the lower right-hand corner and press (Enter). Notice that the mechanics of this is very similar to Block selecting text. Keep in mind that lines and boxes, always replace whatever was underneath them. Therefore, if you are using a line or a box, it is important to allow one character blank space for the lines to be drawn. In addition to using lines and boxes to set paragraphs off in documents, you can do many kinds of business graphics: charts, graphs and diagrams. Surefire User's Guide Page 53 Constructing Tables A table is two or more columns of text and numbers and is used for referencing information quickly. Whenever you want to arrange two or more columns of information side-by-side, you use a table. For example, you may want to set up columns of data that list your monthly sales so you can determine your commission at the end of the quarter and report it to your employer. These figures will be easy to read and manipulate if you present them in a table. In addition, your tables are more readable if you use the techniques you learned in the last section to add lines and boxes to them. Tables are best entered and edited using Typeover mode. Word Wrap should be off so that is doesn't create a lot of formatting problems. The easiest way to enter a table is to use the (Tab) key to align the columns. For example, you could have a 20 character first column for names, a 10 character second column for salaries, and a 5 character third column for hiring dates. Since each of these column widths line up with the default tab stops (5 spaces per tab), then it is a simple matter to hit one or two tabs after each entry to position the cursor at the next column. To line up your columns nicely, choose your columns so that they are all multiples of some number (5 in the above example). Then, set your tab size to that number. To change the tab size, you simply enter the new size in the "Tab size:" text entry field in the Setup window. Now you can use tabs to align your columns. Use the column indicator on the status line to figure out exact cursor positions, as shown below. Remember that changing the tab width only affects the width of the tabs that you are going to type in the future. Therefore, if you have already entered a table earlier in the document using a different tab size, it will be unaffected by your change. After you have entered your text into the table, and are satisfied with the widths of the columns, you can add lines and boxes to make the tables easier and more interesting to read. See "Drawing Boxes and Lines" for more information. Surefire User's Guide Page 54 Chapter 9 - PAGE LAYOUT In business, presentation matters. Present something well, and its merits become more visible than its flaws. Present something badly, and its weaknesses show up more clearly than its strengths. In writing, the word for presentation is "layout". It simply means the physical design and appearance of your document. There are no strict laws governing the layouts for pieces of writing, although there are many standards. The documents you are likely to write in Surefire fall into many different categories: sales reports, business letters, notices to employees, reports of meetings, product announcements and so forth. Each of these categories has been around for a long time and has its own requirements for content and layout. For example, when reading a memo describing a change in policy, most people expect to see how the new policy will affect their jobs. Whereas, when reading a report of a meeting, most people expect to hear who said what and how the final vote went. And, with this expected content comes an expected layout. Therefore, when you start designing the layout for your documents, look at other documents from the same category. When you uncover the most effective layout for the piece you're writing and it is the most appropriate for the reader you have in mind--simply duplicate the layout. Of course, you may want to make some minor changes to suit your own unique purpose and audience. Go right ahead. When you've finished, if your own piece of writing looks well presented to you, it will also look well presented to your audience. In this chapter you will learn some of the many methods Surefire affords for customizing the layout to suit the needs of your document. Specifically, you will learn how to use Surefire's formatting commands to control how your document is printed; and then how to take advantage of the Clipboard to design a more sophisticated layout using desk-top publishing techniques. There's always something that you can do to make your manuscript visually more appealing and effective than you thought of when you were concentrating on getting the ideas straight, rather than how they'd look when printed. We hope that you will be able to use the information in this chapter to produce pages that are attractive and delight the eye. Pages that are inviting and easy to read. Formatting Choices Whenever you set formatting options, you tell Surefire how you want the printed page to look. Surefire gives you many formatting options to choose from so that you have the most readable setting for your printer and the most effective layout for your document. When choosing formatting options, you select the size of paper you want to use, and how wide the margins should be. You specify where you want the printer to start printing, and what size characters to use. Surefire User's Guide Page 55 You also tell Surefire whether or not you want text printed in the margins such as page numbers, titles and dates. You can also add pages or remove them and adjust your text accordingly. Because all of the formatting alternatives add up to a manuscript's total appearance, it's vital that a change made to one aspect of formatting of the document will add and not interfere with the effectiveness of another aspect. For example, if you had wide margins, and tiny text, you could fit a lot of information on the page, but it would be difficult to read without eye-strain. Therefore, the two main concerns when choosing a format for your document is that it is consistent and appropriate to the content. The final thing to think about when choosing a format is whether or not your printer can print your ideas. Many of the formatting choices you'll be making will depend on the limitations of your printer. Obviously, you can print a more finished-looking documents with a laser printer or a letter-quality printer than you can with a 9-pin dot matrix. For the lower-resolution printers your goal might be just making your document readable, while on the higher-resolution printers you might be changing the appearance of a document meant for publication. Changing Character Spacing As you know, text consists of the characters that you enter into Surefire. Characters include letters, symbols, numbers and spaces. Standard characters are available by typing on the keyboard, and special characters are selected from the Special Character window (see "Chapter 8: Adding Emphasis"). In addition, you can alter the horizontal spacing of the characters in the Format window. And as you saw in the last chapter, you can change their attributes (bold or underlined) in the Graphic menu. Although you can have isolated areas of boldface or underlined text, when you change the size of characters in Surefire, you do so for the whole document. Therefore, all of the characters in a document will be the same height and distance apart. The term for character spacing is called font and it is represented by pitch. Pitch is the horizontal spacing of the characters on a line and is expressed in "characters-per-inch". Since Surefire only uses fixed fonts (as opposed to proportional fonts), the pitch of a font determines how close together characters are on the line, but not how far apart the lines are in the vertical direction. Therefore, on some printers, the characters themselves will shrink when they are printed closer together; but for many printers, as you fit more characters on the line, the characters will stay the same height and will be printed smashed together as opposed to reduced in size. The printers that have variable character height are daisy-wheel, letter quality dot matrix and laser printers. Surefire User's Guide Page 56 The number of fonts Surefire lets you choose from varies from printer to printer. For some printers, Surefire lets you choose between elite (12-pitch), pica (10-pitch) and small print (16.66-pitch). You will notice how selecting a different font will change the readability of your text and makes more or less text fit on the page. You should have Surefire set to Insert mode with Word Wrap on. To set a different font, bring up the Format window by pressing (ALT+P) (O). Move the cursor to the "Print Font:" multiple choice button. Use the (End) key until the cursor lands on the default font you have selected for your printer. Press (ALT+Z) to view the list of fonts you have available for your printer. A font is a typestyle, and depending on your printer it can be represented in "pitch", "characters-per-inch", or some name unique to your printer. To view all of the fonts in the list, move the cursor by pressing the (up arrow) and (down arrow) keys. Select one of the fonts in the list by pressing (Enter). Close the Format window by pressing (Ctrl+Enter). Because the new font is either wider or narrower than the one you had before, Surefire will "rewrap" the "wrapped" pages to adjust for the new font. Notice how the amount of text that fits on the page changes for pages where the text is in paragraphs. If the font is very small, all the text may fit on fewer pages and extra pages will be removed. Now, you can print with the new font. If you have a daisy-wheel printer, put in the pinwheel corresponding to the font selected. This is usually very simple, and your printer manual has instructions. Bring up the Print window by pressing (Alt+F) (P). Press (Ctrl+Enter) to choose PRINT. If you need more information on using the Print window, or your document doesn't print, see "Chapter 23: More About Printing". You may notice that choosing a smaller font (larger pitch) will make more characters fit on a line. Recall that the smaller font was displayed with exactly the same number of characters per line that will be printed. In addition, the margins are kept the same width for printing. The margins appear larger on the screen because more characters are needed to occupy the same space. For example, if the left margin was 1" and you are using a pica (10-pitch) font, you will see the margin represented as 10 characters. In contrast, choosing a larger font (smaller pitch) will result in fewer characters fitting on a line, and the margins will shrink accordingly. Keep in mind that this is done because Surefire does not display the change in the size and spacing between characters on the screen (characters are fixed width). Therefore, the margins are displayed as growing or shrinking to accommodate more or less characters fitting on a line. Remember that the margins will not be wider or narrower when printed, but are only displayed that way on the screen to display the new font. The number of characters occupying the page width, length and margins is always the same as it is printed. Surefire User's Guide Page 57 In addition, you will get different results depending on whether you have Word Wrap on or not. Suppose you select a larger font (smaller pitch) than the one you used to type the document and Word Wrap is off. When you reformat with the new font, and your document has some text that no longer fits on a line, Surefire will automatically add another line just below the original line to put the extra text. This will result in very interesting-looking tables and paragraphs! You can return the document to the default font using the Format window. Move the cursor to the "RESET" action button and press (Enter). This will reset the Format window to the default settings. Close the window by pressing (Ctrl+Enter) and watch the text "rewrap". Changing Printers Many people use two printers: one for proofreading and one for final copies. For example, the final copy of a document may be printed on a letter-quality or laser printer, but all of the rough drafts where printed on a 9-pin dot matrix printer. Usually switching between printers is not a problem--all you have to do is select another printer in the Setup window. However, when the printer you are switching to supports different fonts than the first printer you used, you will have to choose a font that is supported by the second printer before it will print. To illustrate, let's say that you previously printed a document on a HP Laserjet using an small print font (16.66 cpi). Later, you revise the document and want to print out the new copy on a EPSONLQ. After switching printers in the Setup window, you'd soon discover that in this case, the document will not print on the EPSONLQ. This is because a 16.66 cpi font is not supported by the EPSONLQ. To be able to print on the EPSONLQ, you will need to change the font setting to one the EPSONLQ will print and reformat the document by selecting a font in the Format window. Incidentally, if the EPSONLQ did support the 16.66 cpi font, Surefire would have automatically choose that font for you when you changed printers. To continue the story, let's suppose that now you want to see what the document looks like when you use the smaller font supported by the HP. You can reformat the document by typing in "16.66" in the "Not Supported:" text entry field while the EPSONLQ is still the selected printer. When you are ready to print on the HP, you can simply change printers in the Setup window and 16.66 will again become a supported font. Surefire User's Guide Page 58 Rewrapping Paragraphs When you changed fonts, you will notice that only the paragraphs were "rewrapped" when you reformatted the document. This is because only the groups of text Surefire considers to be paragraphs will be "rewrapped" in Word Wrap mode. Therefore, when you have a "mixed" document which has tables, charts and diagrams and "wrapped" paragraphs, only the paragraphs will be "rewrapped" when you reformat. In contrast, if you reformat with Word Wrap off to a smaller font, space will be added between the right-hand margin and the end of the text for each line, so your lines will not reach the margin anymore. Reformatting with a larger font will cause extra lines to be added to accommodate the new text. What is a Paragraph? To predict whether or not a group of lines will be "rewrapped" when you reformat with Word Wrap on, you will need to decide whether or not the consecutive lines are a paragraph. In Surefire, two conditions must be met before a group of lines is considered to be a paragraph: 1. The lines are separated from the text above them by either one or more blank lines, or the first line of the group is indented. 2. All lines after the first line must start at the first character position (next to the left-hand margin). Whenever you have a group of lines with one or more blank characters between the text and the left-hand margin, or more than 18 characters between the end of the text and the right-hand margin, you do not have a paragraph. If you have tables and charts in your document, you will want to indent them at least one character from the left-hand margin to protect them from being wrapped. As you saw in earlier chapters, you can join lines by moving the cursor to the end of the first line and pressing Delete (Del). If the next line is not indented, and Word Wrap is on, you can "force wrap" the group of lines into a wrapped paragraph. Here, the second line will "wrap up" to join the first and all remaining lines will "wrap" until Surefire encounters either a blank or indented line. Changing Margins Like changing the font, changing margins can improve the look of your document if used with care. There are a number of reasons why you may decide to change the margins of your document. In the editing or rewriting sections, text may have been added or deleted. The difference in length may cause you to want the appearance on paper to change. Your draft may be on plain paper, and you want your finished copy on letterhead. Surefire User's Guide Page 59 You may have a letter where all the text fits on the first page except for the signature and you want to get the signature to "wrap up". Or, you could have a table that is split between the first and second pages of a 2-page document, and you want to put the whole table on the next page. The "safest" margins to change are the top and bottom. When you change the left and right margins with Word Wrap on, Surefire automatically rearranges the text to fit. Once again, only paragraphs will rewrap to fit between the margins. Therefore, if you have a document with indented text or wide tables and charts, these items may get "clipped" when the margins are made wider (space between the margins gets smaller). To change margins, simply bring up the Format window by pressing (Alt+P) (O). Press (End) or (Home) to move the cursor to the margin setting area. Type in the new dimensions in the "Margins" data entry fields: "Left:", "Right:", "Top:", and "Bottom:". Press (Ctrl+Enter) to close the window and accept the new margins. If you don't like the results and you want to return to the default settings, simply open the Format window again by pressing (Alt+P) (O) and the press (End) to move the cursor to the "RESET" action button. Press (Enter). Keep in mind that like changing fonts, changing margins will affect all of the pages in the document. If you don't want the new margins for all of the pages, you will need to find a different solution if you want to change margins to correct a formatting problem such as inserting spaces to find homes for "orphans" and "widows", breaking a long table into two tables or rearranging text via the Clipboard (see "Chapter 7: Clipboard Editing"). Page Breaks As you know, when entering text, new pages are automatically added as you need them. Likewise, as you remove text, pages are automatically removed as the text in your document contracts. In addition, text entered with Word Wrap on, automatically flows across the page breaks. However, there are times when you'll want more control over what ends up on each page than just letting Surefire automatically handle it. There are times when you want to begin a section on a new page, and you want all the text from that point on to be independent from the text before. Or, you may want to add a graph to the end of the document and want to make sure that no text wraps onto it. In addition, you may want to "lock down" tables embedded in "wrapped" text to prevent them from shifting too far as lines are added and deleted above them. In these cases, you can have more control over page boundaries by using "stop". For example, you may have some "wrapped" text, and then a table followed by more "wrapped" text. As the "wrapped" text before the table grows and shrinks, the table will shift position. To prevent it from being shifted to the extent that half of it is on the bottom of one page Surefire User's Guide Page 60 and the rest on the top of another, you simply enter spaces before it, by pressing (Ctrl+O) to move the whole table to the next page. After the table has been moved to the next page, you may want it to remain independent from being shifted whenever the text on the page before it changes. To do this, you put a "stop" between the two pages to keep them separate. The effect of this will be to "split" the document in half, as Surefire will insert new pages before the "stop" if the text on the page before grows beyond the page's length. Therefore, it is a good idea to put "stops" before tables if you know that the text on the previous page is likely to get smaller or bigger. To make a "stop" (or "hard" page break), move to the page break (a differently-colored area where the two pages join) and press (Spacebar). You will see "STOP" displayed, indicating that text will not flow between these two pages. If at a later time you change your mind about the "stop", you can remove it by placing the cursor on the page break and pressing (Spacebar). The text from the page after the break can now "reflow" back across the "soft" page break, joining with the text on the previous page. Now if there is enough room on the previous page for your table, you may bring it back to the previous page either by using Line Select or Block Select and Delete from the Edit menu, or by pressing (Ctrl+D) enough times to delete the spaces added earlier. As you do this, the table will "flow" from the top of the page to the bottom of the previous page, filling in the gap you just created. Adding and Deleting Pages As you can see, adding "stops" to your document results in breaking your document up into independent sections. If you are entering text into a document, and are ready to start a new section, you can force Surefire to manually add a page after the current one instead of using the above technique of adding enough lines to fill up the page to make Surefire automatically add one for you. To add a page after the current one, simply press (ALT+P) to bring up the Page menu, move the cursor to "Add Page", and press (Enter). The cursor will now start at the beginning of the new page. If you want the page to be independent of previous pages, simply move the cursor up to the place where the two pages join and press (Spacebar) until you see "STOP" displayed. If at a later time, you decide that some pages are unnecessary--a redundant section is just a repeat of earlier arguments, a graph is too confusing and subtracts from your point or a page is mostly blank and its contents can be incorporated into other text--you can remove them by choosing "Delete Page" from the Page menu. This will remove the page, but not the "stop" unless the page is the last one in the document. Surefire User's Guide Page 61 Headers and Footers Imagine typing at the top of every page, "Financial Statement of the Albuquerque Sewage and Waste Water Treatment Facility". After several pages, this could become quite tedious. But by adding a single header at the top of the first page, you can have Surefire do it for you. Headers and Footers are text that appears in the top and bottom margins and are printed on every page of the document. There are many uses for headers and footers such as titles, company names, report footnotes, dates and page numbers. You can even add lines across the top and bottom to accent the text on the page. To place text in the top margin, you simply choose "Header" from the Page menu, move the cursor into position and type. When you are done typing, press (Esc) to return the cursor to the main typing area of the document. Footers are made in the same way except that you choose "Footer" from the Page menu. Automatic Page Numbering Many people, when first trying out word processing, do something very understandable but totally useless. Something in fact that causes them problems: they type in page numbers wherever a page breaks, just the way they would on a typewriter. That's fine as long as the page breaks stay the same. But the minute you add or delete text, change margins, or enforce a page break where there was none before, all the page numbers have to be laboriously relocate, one at a time. Luckily, you can have Surefire number the pages automatically for you in a header or footer. Only the first page needs to be specified-- then all the rest of that document is numbered sequentially, no matter how much it shrinks or bulges in the editing process. To insert a page number, you press (ALT+P) to display the Page menu and choose either "Header" or "Footer"--depending on whether you want the number to appear at the top or bottom of the page. Once the cursor is in the desired margin, you simply move it to the desired location and type #. When you return the cursor to the regular typing area by pressing (Esc), you will see a "1" displayed where you put the number sign. Page and Paper Sizes In Surefire, page size and paper size are not necessarily the same. Page size is the size of the pages aligned end-to-end on Surefire's "electronic paper" (see "Chapter 5: Revising a Document"). This may or may not correspond to the size of paper you are using in your printer. There are many times when you'll want to have a page larger or smaller than the size of the paper loaded into your printer. For Surefire User's Guide Page 62 example, you might be printing one side of a series of half-page thank you notes that are going to be folded in half. Or you might be printing mailing labels, name tags or envelopes. In addition, you may be printing one wide page on two sheets of paper called tiles. To select a new page size, you first bring up the Format window by pressing (ALT+P) (O). Now, move the cursor to the "Page Size" multiple choice button in the Format window and press (ALT+Z) to bring up a list of choices. Choose one from the list by pressing (Enter). As you saw in the list, you can either print "tall" or "wide" pages if your printer supports it. In addition, you can print an oversized (13-7/8 by 11") document in two sections of 8 1/2 by 11" paper (tiles) when the page size is larger than the paper size. If you want to try this, notice that if you have a header or footer on the page in Surefire, it will be printed on both tiles. In addition, you can select a custom page size by choosing "Specific Setting" and entering the dimensions in a special window. The "Specific Setting" is good for setting the page size to correspond to custom pages such as invoices and order forms. In addition, you can use it to create a continuous column of text in a document as you will see later in this chapter. You may have also noticed that you can set the page size to "screen". This is useful for making data entry forms and is explained later in this manual. Likewise, printing mailing labels and envelopes is also found in a later chapter. Generally, printers can not print to the edge of the paper. For example, the HP laser-jet printer uses 1/4 inch of the left and right edges of the paper to grab and move the paper through the printer. You can tell what part of the page is "printable" in Surefire by pressing (ALT+P) (O). Doing this will display the Format window. At the top, you will see "Print Region:". The "Print Region:" gives the area of the page that will be printed and corresponds to what you see on the screen. For example, although the dimensions of the paper you have loaded in the printer may be 8 1/2 by 11 inches, the actual width of the document page as displayed on the screen is only 80 characters or 8 inches. If you place text in a header or foot flush left or right, it will be printed on the paper 1/4 of an inch to the left or right of the edge of the paper. Keep in mind, that the print region is independent of the type of paper you have in the printer. As long as the paper is the size of the page you specified in the Format window, everything you can type on the screen will be printed. Surefire User's Guide Page 63 Printing Your Document Now that you have the layout you want on the screen, see how it looks on paper. Keep in mind that you may still need to make some final adjustments such as allowing room for the letterhead; putting in the right pinwheel for the font you've selected; and figuring out how many copies you want; etc. When all of the considerations are addressed, and you're ready to print, bring up the Print window by pressing (Alt+F) (P) if it is not already displayed. Once again, you move around in the window by pressing (Home) and (End). See "Chapter 23 - More About Printing" for a complete discussion of the options in the Print window. Surefire User's Guide Page 64 Chapter 10 - The Calculator The pop-up calculator is handy and easy to use. In fact, it offers you a way to do even more powerful calculations than you can do with your pocket calculator. It can be used simply to sum a group of numbers or obtain a more complex result such as the payment amount for a loan. The result can even be pasted right into your document. To bring up the calculator window, Calculator is selected from the Operate Menu, or the short cut (Alt+H) is typed. The calculator has one line into which you can type. This "entry line" is at the middle of the calculator. The simplest use is to type in numbers in the entry line. You may also use the operators (+, -, *, /) to add, subtract, multiply and divide. Whenever (Enter) is typed, the current value or expression that you have typed is evaluated. The result is added to the value already shown in the result area. The "result area" is located at the upper left corner of the window. When you first display the Calculator, the result area will be cleared. As you use the Calculator during your Surefire session, the result area will contain the value that was there when the Calculator was last visible. Press (Esc) to close the Calculator and return to your document. To start a new calculation we should first clear the previous result. This is done by selecting the CLEAR button. Use the (End) or (down arrow) key to position on CLEAR and press (Enter). Notice that the result area is cleared. The entry line will be cleared when you begin to type a new expression. You can also clear the entry line expression by pressing (Ctrl + K) when the cursor is on the entry line. You can use parentheses () to group parts of an "expression". Mathematical Expressions Mathematical expressions are formulas that use numbers, numeric operators and numeric functions. Surefire supports the following numeric operators: Two number operators One number operators + Addition - Negation - Subtraction * Multiplication / Division The operators in the first column are used with two numbers. For example, you can multiply two numbers like "3 * 2". The following is also valid: "3 * 2 + 4". This will multiply 3 with 2 and add 4 to the result, which is 10. What if you wrote "4 + 3 * 2"? Well, the result is still 10 since 4 + 6 is 10. This is because division and multiplication have a higher precedence than addition and subtraction. Precedence means that numbers Surefire User's Guide Page 65 with "*" (multiplication) or "/" (division) between them are calculated first, even if they appear to the right of other values. You can tell Surefire to override the precedence rules by enclosing parts of an expression in parentheses (). Suppose you really wanted to add 3 with 4 and then multiply by 2. This can be done by associating the expression "4 + 3". To do this, parentheses are put around this part of the expression. The expression is now: "(4 + 3) * 2" and the new result is 14, since 7 multiplied by 2 is 14. Any number of matched left and right parentheses can be used in expressions. The negation operator is nothing more than a minus sign (-) before a number or expression. It is used to specify a negative number such as "-10" or "-(30*2 - 10)" which evaluates to "-50". Once you have a negative value, you can use it in an expression. For example, if you wanted to multiply -10 by 4 you could enter either: "-10 * 4" or "4 * -10". This expression would give the result of -40. Using Functions Mathematical expressions can also contain functions. Functions allow you to perform more sophisticated operations on values than you can with numeric operators alone. For example, you can use a function to calculate the present value of your mortgage loan or sine of some angle. Functions in the Surefire Calculator work with numeric values. All functions in Surefire start with the special character "@". If a function uses arguments, these arguments are specified within parentheses and each is separated by a comma. The function @SQRT(n) uses one argument while the function @PV(pmt, int, term) requires three arguments. Two other numeric functions available in the calculator are @ABS(n) and @SIN(n). These functions are used to determine the absolute value and sine of a number respectively. They are used by substituting "n" with the number you want to evaluate. There are many functions that can be used in the calculator. To see what functions are available for use in the calculator, type (Alt+Z) when the cursor is positioned in the calculator's entry line. This will display a pop-list of all available functions with placeholders for their arguments. You may scroll through this list using the (down arrow) and (up arrow) keys to find the one you want. When the desired function is highlighted, you can choose it. Press (Enter), and that function will be put into the entry line starting where the cursor is when you typed (ALT+Z). You can then replace the arguments with the right numbers or other smaller expressions. When the expression is complete, press (Enter) once more to have the result of the expression added to the value in the result area. Surefire User's Guide Page 66 All functions that are available in Surefire and in the calculator are summarized in "Appendix A: Surefire Function Reference" located near the end of this manual. You may use any of the General Mathematical Functions, Trigonometric Functions, Logarithmic Functions and Financial Functions described on pages A-1 to A-3 within the calculator. All the expressions and functions available for the calculator can also be used as field commands. Field commands can do many more complex things like manipulate text and dates, perform database operations and even link databases together. After you gain an understanding of fields in Surefire, you may read "Chapter 14: Introducing Field Commands" for complete information. Calculator Errors If the Calculator cannot evaluate what was typed in the entry line, the word ERROR is displayed in the upper right corner of the window. The previous result is not disturbed. This error message will go away when the next good expression is evaluated or the result area is cleared. To clear a calculator error, press (down arrow) to move the cursor to the CLEAR button. Press (Enter). ERROR will disappear. You can now return to the entry line to type a valid expression. Pasting a Result The resulting value of a calculation can be put directly into your document by choosing the PASTE button. For the time being let's assume that your document does not have any fields. Since you are therefore working in Text edit mode, the value in the result area will be put onto the document page at the location where the cursor was when you opened the Calculator window. The value is inserted or overtyped depending on the current Insert or Typeover status. If Word Wrap is on, normal wrapping will occur. For information on pasting a result when there are fields in a document, read the appropriate section of "Chapter 13: Working With Fields". Surefire User's Guide Page 67 Chapter 11 - Introduction to Fields A field is an area in the document that can contain a value or formula. It can hold the monthly payment of a property lease or the totaled expenses for a recent trip. It can act as a placeholder in a form letter or a way to enter information into a database. A field can contain today's date, your friend's name or enable you to view another document. Fields are the key to making Smart Documents. These documents can act like fill-in-the-blank forms or control complete applications. You are already somewhat familiar with fields because you have used them in Surefire system windows. Except for multiple choice buttons, the fields that you can create are the same. For example, if you look at the Get File window, you will see three fields: one data entry field or text field, and two action buttons or button fields. There are five types of fields that you can create and use in a document. They are text, numeric, date, logical and button fields. In the next two chapters you will learn about each of the different field types; numeric, text, date, logical and button and their attributes. These attributes determine how field values are displayed and stored. In the chapter "Working with Fields", you will learn how to move fields around, modify the attributes of existing fields and work with fields and their values. Fields and Forms We introduce fields by showing how you can use them to make documents that look like forms. Most of you are already familiar with pre-printed paper forms. On these forms, most of the words are already on the page. You need to just fill in the blanks with additional information to complete a form. Examples of common forms are lease agreements, order forms, expense reports and standard contractual agreements. With Surefire, you design and lay out a form by first using Surefire's word processing capabilities to enter text and graphics on the document page. Then you combine this with the fields that you place anywhere within your document. These fields will hold the data that is important to you and the task that your document will help you solve. Editing and Using Documents The basic concepts for editing documents with fields are the same as for editing documents without fields. Inserting and wrapping text, cut & paste, and saving and getting documents are among the operations that are essentially the same. And you can use the (End) and (Home) keys to conveniently move around your document via fields just as you do in Surefire system windows. The only new concept is how to create and modify the fields' formatting capabilities. Surefire User's Guide Page 68 The concepts of editing and using a document are very important in Surefire. Very simply, editing a document allows you to change the format or layout of a document with fields, while using a document allows you to enter, display, store, calculate and otherwise manipulate the values in fields. Later in the manual, we will discuss how to edit the actual values that these fields may hold. These values may be manipulated by commands and may be stored in a database. And, you can use commands to cause actions to happen, such as displaying other documents, searching a database, etc. This is just like the action buttons in system windows. To start, you will learn how to create fields and use them in simple ways. Moving Around a Document via Fields When there are fields present in a document, you can move around in two different ways. The cursor can be "tied to fields" or the cursor can be "free". This is true whether you are "editing" the document (i.e. Document edit mode) or "using" the fields of the document (i.e. Use mode). You switch between these two ways of moving around by pressing the free cursor key, (F3). When the cursor is free, an "F" can be seen on the status line. Otherwise, the cursor is tied to the fields. There always is a field called the "current field". This is the field that is highlighted. A field becomes highlighted, and thus, the current field when the cursor is moved onto it. Cursor Tied To Fields When the cursor is tied to the fields, basic movement is identical to the way you move around among fields in the Surefire windows. The arrow keys will move you to the next field up, down, left and right as long as they are lined up. (Home) and (End) will move you to the previous or next field in the same direction as you would read text. This is generally from left to right and top to bottom. (Ctrl + Home) and (Ctrl + End) will bring you to the first or last field on a line. The above keys work only within a single page except for (Home) and (End). Pressing these keys will continue to bring you to the next or previous field even if it exists on some other page of your document. In addition, (Ctrl + Page Up) and (Ctrl + Page Down) will bring you to the first field of the previous or next page. This is similar to using these keys when the cursor is free. These keys are listed in the table on the following page. Surefire User's Guide Page 69 Free Cursor When the cursor is free, you may move around a document with fields in exactly the same way as you move around a document with only text. The cursor is free to be positioned anywhere. What you can do once you position the cursor is different depending upon whether you are editing the document or using the document to enter values into fields. The sections Editing Fields and Entering Information into Fields in the chapter "Working with Fields" will point out these differences. The keys that you may use to move the cursor are listed in the table below. To Move Press Left one field Home Right one field End Up one field Page Up Down one field Page Down To the start of the line in a text field Ctrl + Home To the end of the line in a text field Ctrl + End To the previous page Ctrl + Page Up To the next page Ctrl + Page Down Key Usage - Cursor Tied to Fields To Move Press To the beginning of the line Home To the end of the line End To the previous screen Page Up To the next screen Page Down To the beginning of the document Ctrl + Home To the end of the document Ctrl + End To the previous page Ctrl + Page Up To the next page Ctrl + Page Down Key Usage - Free Cursor Creating Fields Fields are created by using the Field Create window. Before opening the Field Create window, position the cursor in the document to where the upper left corner of the field will be put. Then, open the Field Create window by choosing "Create" on the Field menu or pressing (ALT+C). The first multiple choice button allows you to flip through all the types of fields that can be created, displaying all the field attribute options for each. You may press (Spacebar) repetitively to show the available field types or you may press (ALT+Z) to show a pop-list with these types. After the desired field type is found, you may specify the individual field attributes by moving to the various attribute settings in the window. These initial values may easily be changed after the field is created. Surefire User's Guide Page 70 The field is then created by selecting OK. If the field being created is a date, logical or button field, it will have a pre-defined size. This type of field is immediately inserted into the page or overwritten onto the page depending on whether Insert or Typeover mode is on. The size of date and logical fields are determined by the format that you have chosen. The size of a button field is determined by the label that you have given it. Note: Surefire will not allow you to create a new field on top of an existing field. Sizing Text and Numeric Fields Text and numeric fields are sized when they are created after the Create Window is closed. When you choose OK for these fields, the cursor is placed at the starting position that you have indicated for the field. At this time, using the (right and down arrow) keys allows you to specify the exact size of the field on the page. When the sizing is finished, press (Enter). If you wish to cancel the field create operation, you can press the (Esc) key. If you bump up against another field, Surefire will not allow you to continue in that direction. Just use the (left and up arrows) to make the field smaller. You can move the field or change its size later. The sizing operation will be affected by the current insert mode. If Insert is on, every time the field is sized to the right, the text and fields to its right are moved over. If Wrap is on, wrapping is also done. A text or numeric field may be a multiple line field. Multiple line fields cannot be created when Insert is on. You must switch to Typeover mode before you open the Create Window to create a multiple line field. When a field is created in Typeover mode, any text under the field will be overwritten. Field IDs You do not need to worry about naming or labeling each field that you create. If you want, you may type descriptive text near a field so that you know what the field is used for. Surefire assigns an ID to a field when it is created. This ID is a name that Surefire uses to distinguish one field from another. Within a document, no two fields will have the same ID. IDs are discussed in greater detail in the chapters Using Field Commands and Spreadsheets. Surefire User's Guide Page 71 Chapter 12 - Field Types and Attributes A field restricts the type of information that is put into it. Generally, the type of information that can be put into a field corresponds to the type of field it is. A field can be numeric, text, date, logical or button. Numeric, text and date fields allow only numbers, text and dates in them. Logical fields allow only yes or no (or true or false) as their information. Button fields are somewhat different in that they do not allow any information to be entered into them. Think of a button that you would press on your VCR or stereo. This button may turn on the device or cause a tape to be rewound. A button field in Surefire has a similar purpose. They provide a means for doing specific actions when they are "pressed". These actions are specified as field commands which are discussed in detail in later chapters. The precise way in which fields handle information is determined by their field attributes. There are two types of field attributes: format attributes and data attributes. Field attributes are set by using the Create Field or Modify Field windows. These windows are opened by choosing "Create... Alt+C" or "Modify.. Alt+M" from the Field menu and are described in this and the following chapters. You must be in Document Edit mode to give or change field attributes Format Attributes The exact way in which a field accepts and displays information is determined by the specification of its format attributes. For example, format attributes for the numeric field include whether numbers are to be displayed with $'s and commas for currency and where the decimal point is to be placed. All the format attributes of all fields are described later in this chapter. Many format attributes such as text and numeric justification, currency symbol placement, etc., take effect after entry of a value into a text field. Entry occurs when you move the cursor out of the field or press (Enter). Data Attributes The data attributes describe whether the information stored within a field is stored in a database or not. These data attributes are fully described later in this manual in the chapter entitled "Introduction to Databases". Surefire User's Guide Page 72 Text Fields Text fields provide the most general way of entering information. Any text that you can normally put in a document can be put in a text field in the exact same way. There are three main differences. One difference is that the boundaries for the text are the field limits rather than the margins on the page. Another difference is in the flexibility of formatting the text after entry. The last difference is that text field values can be stored in a database and used in formulas. The following sections describe the format attributes available for text fields. Justified Text Formats Text justification can occur after entry of a value into a text field. The text can be left justified, right justified or centered within the field. This is done by setting the first format multiple choice button to Left Justify, Right Justify or Center. Unjustified Text Formats There are two other format options on this multiple choice button. They are Don't Justify and Wrap Text. Nothing happens on entry when either of these attributes is set. When Don't Justify is set, the text stays wherever you type it within the field. When Wrap Text is set, word wrap occurs whenever the text needs to, just like within a page. Changing this attribute to Wrap Text after there is already some text in the field does not remove white space or break words for you. Rather, it changes the way the field organizes the text during subsequent editing in the field. Single vs Multiple Lines Text Fields can have one or more lines in them. All format attributes except wrap apply to single line text fields. Wrap and Don't Justify behave identically for single line fields. For multiple line text fields, justification occurs on a line by line basis. For example, if Center is specified, every line will be centered when it is entered. If Wrap is set, text is formatted according to the same wrap rules discussed for general word processing except it occurs within the boundaries of the field. Numeric Fields Numeric fields provide the means to enter various types of numbers. These can be decimal or integer numbers, percentages or dollars, etc. When entering information into a numeric field, only numbers and a few specific characters such as the minus sign ("-") and the decimal point (".") are allowed. All other characters are ignored. Surefire User's Guide Page 73 Numeric Appearance The first format multiple choice button in the Create or Modify Field window allows you to choose the general appearance of the number that will be displayed in your field. These choices are summarized as follows: Appearance Description Decimal This is a number containing a single decimal point somewhere within it. Comma This is the same as Decimal except commas are inserted automatically at every third place. Percent This is a number that always displays the percent sign ("%") and always divides the contained number by 100. This is very convenient when the field is referenced by a formula. Field Commands and formulas are described later in this manual. Currency Currency will always display a dollar sign '$' at the left of the number. It will also provide commas at every third digit. Negative Representation The second format multiple choice button provides two ways in which a negative value can be displayed. The normal way is with a minus sign '-'. This is specified by choosing "-Negative". The other way puts the number inside a set a parentheses. This is generally desirable when working with accounting information. This is specified by choosing "(Negative)". Numeric Justification The third multiple choice button allows you to set the justification for the field. Numbers can be left or right justified. As with text fields, the justification occurs after you enter a value in the field. Other Numeric Format Settings In addition to the three multiple choice buttons, there are three other items that you may specify for numeric fields. The first is labeled "Decimal Place:". The number entered here indicates how many places to the right of the decimal point should be maintained in the field. Surefire will use this setting to display the value. The second item is labeled "Integer?". Here one can choose Y for Yes or N for No. Yes indicates that the number is to be rounded automatically to the nearest whole number before being displayed. Internally, however, the number is remembered to be the exact value Surefire User's Guide Page 74 entered. If the number of decimal places is set to one or greater and you typed in a number with a fractional part (i.e some digits to the right of the decimal point), after you finished entering it, the fractional part would not be displayed. The third item is labeled "Pad". You use this attribute to say whether the number is displayed with leading zeros or blanks to fill up the width of the field. If you choose "Blank if Zero", the field will display the number zero as a blank or empty field. This setting is useful if you have a form with many 0 values and you want to improve readability. Single vs Multiple Cells Numeric fields can contain more than one "cell". Each cell can contain one number. Multiple cell numeric fields have more than one cell stacked vertically. All cells for any one numeric field are always the same size and have the same format attributes. A multiple cell numeric field is created by using Typeover mode and the (down arrow) key to show that the field occupies more than one line. Multiple cell numeric fields are useful for designing smart documents that look like spreadsheets. Date Fields Date fields provide ways to enter and display dates. Date fields always assure that the dates contained within them are valid dates. That is, only 12 months can be represented and the appropriate valid days for a month can be represented. In addition, you can only specify February 29th for leap years. Date Styles There are three styles of date format. The format is specified by using the format multiple choice button on the Create or Modify Fields windows. The three formats are as follows: Date Style Description mm/dd/yy This format allows you to enter the month, day and year by the 2 digit number that represents it. Example: 5/4/32 dd-mmm-yy This format specifies the day first as a two digit number, then the month as the three letter abbreviation and finally the last two digits of the year. Example: 13-sep-67 Month dd, yyyy This format completely spells out the name of the month followed by the day and then the year. Example: November 23, 1945 Surefire User's Guide Page 75 With the first two formats you will be able to enter dates within the current century Generally, these dates will be between Jan 1, 1900 and Dec 31, 1999. The last format allows entry and display of dates that are from January 1, 0001 through December 31, 9999. Default to Today The "Default to Today?" option is specified by toggling this logical choice button to Y for yes or N for no. You toggle by pressing the (Spacebar) until you see the desired value. If this value is set to Yes, the field will contain today's date, in the style you specified, when the document is read in. This is convenient for forms and letters that need to be dated with the current date. You would not have to look at your calendar each time and fill it in. If necessary, however, you could change it. Even if this option is not set for a field, you can easily enter today's date. With the cursor positioned in the date field, type a letter 't' or 'T'. You will see today's date displayed in this field in the appropriate format. This is a shortcut for entering today's date in a date field. Logical Fields Logical Fields provide a way of limiting the information to either a yes/no or true/false answer. A logical field is like a simple multiple choice button with two choices. The style of the choices can be specified. There are four logical styles. These are selected by choosing the appropriate style with the format multiple choice button. The available styles are "Y/N", "Yes/No", "YES/NO" and "True/False". Button Fields As mentioned earlier, nothing can be directly entered into a button field. A button field can be "pushed" by pressing the (Enter) key when the cursor is on the button. This can cause an action to occur. A field command describes the action that will take place when the button is pushed. An example of such a command is one that displays another document when the button is pushed. Without a command, pushing a button will do nothing. Field commands are described later in this manual. There is only one attribute to specify for buttons. This is a label. The label is any text that will represent the button in the document. You type the label that you desire next to the word Label: in the Field Create Window. Then choose OK or press (Ctrl+Enter) to create the button. Surefire User's Guide Page 76 Fixed vs Auto Sized Fields Text, Numeric and Date fields can be set to be Fixed Size or Auto Sized. When a field is set to Fixed Size, it always takes up the same amount of space on the page no matter what the content of the field is. If Auto Sizing is set however, the document will automatically adjust based on the width of the value in the field. For a text field with multiple lines, empty blank lines at the bottom of the field will also be removed causing the document to contract further. This automatic adjustment is done when you change to Text mode. If no changes are made in Text mode, returning to Use the document will cause Auto Sized fields to expand back to their maximum length. The notions of Using a document versus editing a document as text or as a document are covered in the following chapter. Auto Sizing can be used to personalize letters with people's names, for example. The name is put in an auto sized field so that when the document is printed, the spacing will be adjusted appropriately to produce a letter that looks like it was typed on a typewriter. Auto sizing will occur automatically during a Search & Print operation. This operation is often referred to as "Mail-Merge". See Chapter 20: "Forms and Form Letters" for a complete description of this process. With regard to date fields, auto sizing only affects date fields formatted where the month name is fully spelled out. Surefire User's Guide Page 77 Chapter 13 - Working With Fields In the previous two chapters you were introduced to the concept of fields and how to create them. In this chapter you will learn how to change a field's formatting characteristics and how to move fields around in a document. Editing Fields At some point, you may want to revise a document that has fields. You can edit just the fields or the fields and the text of the document at the same time. Editing fields in a document means changing the way they look, changing their size, moving them around or removing them altogether. You will not be changing their values. Any values that are in the fields will be preserved. To edit a document that is a combination of text and fields you must switch to document edit mode. To do this, you choose "Document" from the Operate menu or press (ALT+F9). When you look at a document while in Document Edit mode, the fields are shown filled with letters that indicate their type: n for numeric, c for text, L for logical, d, m and y for date and B for button. This provides additional feedback that you are going to be editing the layout of the document and not field values. You can edit both the textual portions of the document and the fields together. As you switch between using and editing the document, some fields, such as a numeric field with a Currency attribute carry more information than the fact that it is a number. For example, $nnnnn.nn means that the field is a currency value ($) with 2 decimal places (.nn). Fields can be edited only when the Operate mode is Document edit. When there are no fields in the document, the Operate mode is Text edit since only text can be edited. The Operate mode becomes Document edit automatically after you create the first field in a document. You can also explicitly choose "Document" from the Operate menu at any time when there are fields in the document. If you type text when the cursor is not on a field, the text will be put on the page just as if you were doing only word processing. All the word processing rules apply. Conversely, when you type while the cursor is on a field, nothing will happen. Surefire User's Guide Page 78 Single and Multiple Line Fields Fields that occupy a single line are treated like words. Inserting text, wrap and all the word processing operations move the field just as if it were a word. This lets you enter text easily without having to worry about positioning in-line fields. For example, in a lease or contract, many fields are found in paragraphs with normal text on either side. Changing the wording of the paragraph should move the field automatically. Multiple line fields, or fields that occupy more than one line are handled a little differently. You can insert text around these fields as long as there is enough white space to accommodate the new characters. Multiple lined fields are moved up and down as lines are inserted and deleted above and below them. You cannot move these fields left or right in this manner. This must be done by using Cut and Paste. See the section Moving and Copying fields later in this chapter for a complete discussion of this process. Note: There is one other limitation to placing multiple line fields. That is, multiple line fields cannot be broken up between pages. As a result, if you force a multiple line field across a page boundary, by inserting or deleting lines, all lines that the field crosses will be pushed up or down across the page boundary together. Modifying Field Attributes You can change the attributes of a field by putting the cursor on the field that you wish to modify and choosing "Modify... Alt+M" on the Field menu. This will display the Modify Field window. You will note that this window is the same as the Create Field window except that you can not change the field type. All of the currently set field attributes for the field you have selected are displayed and any of them can be changed. The changes take effect when you choose OK. You can change your mind, as usual, by choosing CANCEL. Resizing Fields Text and Numeric fields can be resized interactively. You do this by placing the cursor on the field that you wish to resize. Then, by using the arrow keys to move the cursor, you can redefine the extents or size of the field. When you choose "Size" on the Field menu or press (ALT+V), the cursor is placed on the lower right corner of the field. You adjust the size by using the arrow keys in the same way as you did when you created the field. You can always cancel a resize operation by pressing the (Esc) key. As usual, press (Enter) to accept the new size. The resizing operation obeys Insert and Wrap modes accordingly. This means that when you make a single line field longer or shorter, the text or other fields following this field on the page, will be moved over and wrapped down or up just as if you were inserting characters. When you resize multiple line fields, you must first make sure that Typeover is set. And, if you are enlarging the field, you should see Surefire User's Guide Page 79 that there are no other fields to the right or below that will be covered by the larger field. It is a good idea to first insert extra lines below a multiple line field that you wish to make larger. Note: You may not delete a field by sizing it smaller than 1 character. Read the section below for information on how to delete fields that are no longer needed or desired. Deleting Fields Fields can be deleted along with text that has been Line or Block selected. You do this by choosing "Delete" on the Edit menu. The currently selected field or current field can be deleted directly by choosing "Delete" on the Edit menu. Notice that the Delete choice does not have a shortcut. This is a precaution. If you delete a page, by choosing "Delete Page" from the Page menu, all the fields as well as the text on that page will be deleted. Because Surefire does not want you to lose important data, you will be warned if you try to delete a database field. In addition, you will not be able to delete a field by deleting the current line or end of line with (Ctrl+D) or (Ctrl+E) respectively. If you delete all of the fields in a document, Surefire will automatically return you to Text edit mode. You will note that the "Use Alt+F7" and "Document Alt+F9" choices on the Operate menu are disabled. When you again add fields to the document, these choices will become available once more. Editing a Document with Fields as Text The choice "Text Alt+F8" on the Operate menu allows you to edit the document as if it were nothing but text. This means that the values currently displayed in the fields, become simply text on the document's pages. Once changes are made to a document during Text edit, the placement and characteristics of the fields are no longer maintained. You can no longer edit the document as a document or use the document to manipulate field values unless you Get the saved version of the document. Editing a document as text is useful to make annotations or add specific wording or emphasis for one-time usage. You can then print the document or save it as a Report without altering the general make-up of your original document. See "Chapter 22: Generating Reports" for information on how to save documents as reports. Moving and Copying Fields You can move and copy (duplicate) fields that are interspersed with text by using Cut & Paste just as you would with text alone. The only difference is that the selection of the mixed text and fields must fully contain the fields. In other words, you cannot try to select part of a field. If you do, a message will let you know that the operation cannot be done. Surefire User's Guide Page 80 Fields that are cut or copied will be put in a clipboard object along with any text that was also selected. The contents of the clipboard object can be pasted elsewhere in the document or even into another document. If you are in document edit and choose Cut or Copy from the Edit menu without doing a selection first, the current field will be cut or copied. You use the Cut operation to move fields and the Copy operation to copy them. When fields are cut, the fields contained in the cut will still retain their unique identifiers, all attributes and associated field commands. Later, when you paste the clipboard object, the fields in the new location will be exactly as they were before. This means that the fields were moved with everything else intact. If, however, you use a paste & keep operation instead, the initial paste will work as a move but any secondary paste operations will cause new similar fields to be created with new IDs. These new fields will not retain any field commands that were associated with the original field. When fields are copied, the fields in the clipboard object will retain their format attributes but not their unique identifiers, values or field commands. A Paste or Paste & Keep operation will cause new fields to be created with new IDs. If any of the original fields had a data attribute set to Stored, the new duplicate fields would have their data attributes set back to be Not Stored. When you Paste or Paste & Keep fields between documents, the fields will retain their format attributes but not their unique identifiers, data attributes or their associated commands. This is because the command references and data storage specifications can no longer be valid in the other document. Entering Information into Fields When documents are not being edited, they can be Used. This allows you to use the document so that only the information within fields (its values) can be changed or manipulated. Fields provide a way to enter information in an easy and rapid manner. As discussed in the previous chapter, the way in which you enter information into fields depends on the type of field and the field's specified formatting attributes. You could use a document as a pre-made form, as a spreadsheet to perform calculations or as a way to enter or view information in a database. Using a document is what really distinguishes a Smart Document from an ordinary document. During Use mode, even though you can put the cursor anywhere in the document, you can only enter information into a field. Attempting to type anywhere else will result in nothing happening. The cursor must first be positioned on a field. You can use a free cursor or a cursor that is tied to fields to position your cursor. Surefire User's Guide Page 81 If the current field or cell contains a field command, a '#' will be displayed at the far right of the status line. This let's you know quickly that the current field or cell has a command. Any value you enter in the cell will most likely be overwritten when that field command is executed. Just bypass the field and move on to another one. Entering Dates In order that you do not have to type every character of a date, you follow simple rules for entering values in date fields of each of the three date formats. In addition, today's date can always be specified by simply typing the letter 't' or 'T' when the cursor is in a date field. Date fields always assure that the dates contained within them are valid dates. That is, only 12 months can be represented and the appropriate valid days for a month can be represented. Of course, you can only specify February 29th for leap years. When you enter values into a date field, use the (left and right arrow) keys to move between the month, day and year parts of the date. With the first two formats you will be able to enter dates that are in the current century, that is between Jan 1, 1900 and Dec 31, 1999. The last format allows entry and display of dates that are from January 1, 0001 through December 31, 9999. The rules for each of the formats are as follows: Date Style Description mm/dd/yy This format allows you to enter the month, day and year by the 2 digit number that represents it. Type the month number when the cursor is over the mm part, the day number when the cursor is over dd and the last two digits of the year when the cursor is over yy. dd-mmm-yy This format specifies the day first as a two digit number, then the month as the three letter abbrev and finally the last two digits of the year. The day and year are entered by typing the appropriate number when the cursor is over the dd or yy part. The month is specified by typing in the first character of the month name. If the cursor is in the month part of the field and you type the letter 's', the month will become 'sep' If you type the letter 'j' you will get 'jan'; to get 'jun' type 'j' again; type 'j' one more time to get 'jul'. Surefire User's Guide Page 82 Month dd, yyyy This format completely spells out the name of the month followed by the day and then the year. You type in a two digit day and then you can type in a four digit year. The month is specified by typing in the first character of the month name. The remaining characters are filled in automatically. If the cursor is at the start of the field and you type the letter 'n', the month will become 'November'. If you type the letter 'A' you will get 'April'; to get 'August', type 'A' one more time. Pop-Lists Any single line text field can have a pop-list associated with it. This pop-list contains pre-set values for the text field and can be used, created or edited at any time while you are using the document. Pop-lists are useful for storing pre-set text strings that are used often for a particular text field. You will avoid unnecessary keystrokes, you won't make as many spelling mistakes, and you will be certain of using only one version among similar values. For example, a pop-list for a field with people's titles might include: President, Secretary, Administrator, His Royal Highness, etc. If the current field is a text field with a pop-list, a 'P' will be displayed in the upper right corner of your screen. This lets you know that there are available selections before you start typing a value. Creating a Pop-list To create a pop-list, position the cursor on the text field and press (Ctrl+Z). A window is opened in the center of the screen. You may add or change as many items as you wish using the same editing commands you are already familiar with. Just type each value that you want on a line of its own and press (Enter) to move down to the next line. Up to 30 items can be put in a pop-list. When you are finished, press (Esc). You can then define or change pop-lists for any other single line text fields in your document. The pop-lists you create are immediately available but you must save the document if you want the pop-lists to be retained for subsequent sessions. Using a Pop-list To use a pop-list, you zoom it like any other zoomable item in Surefire. With the cursor positioned on the text field, press (Alt+Z) to display the pop-list. Then, you can move around with the (up and down arrow) keys or (Page Up) and (Page Down), until the item that you wish is highlighted. Choose this item with the (Enter) key. When you choose an item, that text will be copied into the current text field and the pop-list will be closed. You can leave the pop-list without selecting anything by using the (Esc) key. Surefire User's Guide Page 83 Clearing Field Values You can clear the values in individual fields or all fields in the document at one time. An individual field is cleared by pressing (Ctrl + K) when that field is the current field. You can clear all fields in the document by choosing "Clear Fields " from the Field menu or pressing (ALT+Y). Locating Specific Field Values Because of Surefire's unique design there is no special mechanism for finding specific field values in your document. When you are using the document, you can select "Find... " from the Page menu or press (ALT+T) to open the Find window. This is exactly how you use Find without fields. You can type in a pattern and choose NEXT or PREVIOUS to search forward or backward in the document for that value. Surefire will locate matching patterns anywhere in the document , whether or not it occurs in a field. You can use this feature to search for and change incorrect field values by skipping matches that do not occur in a field. Printing a Document with Fields There are three ways that you might want to print a document with fields. Each of these results follow naturally from the way you are looking at your document on the screen. 1) You can have your form look the way it does on the screen when you fill it out, with underlines defining each field. If you wanted to print out a "blank" form to be filled in by pencil, you can clear all fields by choosing "Clear Fields" on the Field menu before you print. 2) You can see the definition of your form with text surrounding field placeholders. 3) You can see the field values, auto-sized as needed, without underlines. Notice on the first line that the excess space between "Alice Fay Jones" and "of" has been removed. This happened because autosizing was set for the text field containing "Alice Fay Jones". To print your document the first way, make sure you are in Use mode before printing. To achieve the second type of output, print while you are in Document edit mode and finally the third result will occur while you are viewing your document in Text edit mode. In all three cases, you print the same way as you would for documents without fields. You choose Print from the File menu, change any options in the Print window and choose OK. Surefire User's Guide Page 84 Copying and Pasting Values Among Fields While using the document, you can Cut or Copy field values and Paste these values into other fields in the same or a different document. For example, you may have a large block of text in a field that you want echoed in another field. You really don't want to retype the text word for word. To copy the value, move the cursor to the field and press (ALT+F2) to put the value in a clipboard object. Then, move the cursor to the field that will get the value and press (ALT+F3) to paste the value. You may also Cut the original value if you no longer want it in the original field. And, of course you may Paste & Keep the clipboard object if you want the value copied to more than one field. Note: When you paste text into a multiple line text field the text will be pasted into all lines of the field starting at the first line no matter which line of the field the cursor is on. Copying and Pasting Values To the Calculator If the current field is a numeric field, you can place the value of the current cell in that field directly into the entry line of the Calculator. To do this just type (Ctrl + Enter) when the Calculator is visible. The same value that was displayed in the numeric cell is inserted into the entry line of the Calculator just as if it were typed. Likewise, the resulting value of a calculation can be put directly into your document by choosing the PASTE button. The value will be pasted differently depending on whether you are currently using or editing the document. Choosing PASTE closes the Calculator window. If you are using the document and the current document field is a numeric field, choosing PASTE will put the current value from the result area of the Calculator into the current cell of the numeric field. If, however, you are currently working in Document edit or Text edit mode, the result is put onto the page at the location where the cursor was when you opened the Calculator. The value is inserted or overtyped depending on the current Typeover status. If you are editing the document, you will not be able to paste a value on top of a field. If Word Wrap is on, normal wrapping will occur. Surefire User's Guide Page 85 Chapter 14 - Introducing Field Commands As you've seen in the previous chapters, fields by themselves are very useful in constructing and entering data in forms such as time cards, property leases, orders and other standard contracts. But you need to enter a value in each field or cell. With field commands, some field entries could be automatically determined from information you already entered in other parts of the document. You could even access an often used form letter or search for a specific type of information by the push of a button. With field commands you can create the most intelligent Smart documents that can even become entire applications. What is a Field Command? A field command consists of one or more lines of text connected to a field or cell. This text tells Surefire specifically what to do. Generally, this is an action or calculation which occurs when the command is executed. Most of the time, commands are executed after information has changed in one or more fields. The lines of text that make up a field command contain expressions and functions that are appropriate for the type of field that contains the command. You have already seen expressions and functions in the Calculator. While in the Calculator you can only have mathematical expressions and functions, field commands are much more varied. For a numeric field, a mathematical expression is the simplest form of field command. For example, "2 + 2" can be defined as a command in a numeric field. When the command is executed, the result "4" is displayed in that field. This is very similar to the operation of expressions in the Calculator. In fact, any numeric expression or function that can be used by the Calculator, can also be a numeric field command. For other types of fields, there are additional functions and operators that allow you to manipulate the data values or information contained in those fields. For instance, a date field function allows you to calculate a date that is 15 days from today; a text field operator allows two text strings to be combined together to produce a third. Operators available for each field type will be described in the next chapter. In this chapter you will learn the basics of using field commands. Surefire User's Guide Page 86 What Can Be Done with Field Commands? Your document can accomplish much more with field commands than simple addition. Extensive capabilities involving numbers and mathematical functions are available. In addition to numbers, one can also manipulate dates and text. Determining a date so many days before or after today is an example of a date expression. The result of a date expression is displayed in a date field in the format that you have chose for that field. As for text, you can use field commands to substitute a portion of one string of text with another, change case, combine strings to form a new string and various other text manipulations. Commands can also be used to control what happens. This is done using conditions and control functions. An example of a simple condition is to display "Balance Overdue" if today is after the due date for Joe Smith's monthly loan payment. Conditions are often used with logical fields. Control functions can cause something to happen when a button is "pushed", or when a specific value is entered into some field. This might be the display of another document, searching a data base or even running a DOS command or another application. Control functions are generally used with button fields. A complete description of field commands and examples of how they can be used, can be found in Appendix A. Field IDs A field ID is automatically assigned by Surefire when a field is created and is guaranteed to be unique for the document. This ID is used in commands to reference or represent each individual cell in a document. Single line fields have only one cell whereas a multiple line field has one cell per line. Since only text and numeric fields can be multi-lined, only text and numeric fields can have more than one cell. IDs consist of one or two capital letters optionally followed by one or two digits. The letters describe a field uniquely while the numbers identify the line or cell within the field. Examples of IDs: L B3 AA1 Q11 Specifying Commands You specify field commands using the Command Edit window which is displayed by selecting "Commands " on the Field menu or by pressing (ALT+F10). This window is actually a pane that appears at the top of you screen so that your document is not obscured. Among other things, this window allows you to enter the actual command, view commands that already exist in fields, and copy similar existing commands to other fields. You can also give a field a more memorable name if desired. Surefire User's Guide Page 87 In the Command Edit window there is a label called "ID:". To the right of this label is the field ID of the current field cell. This is the unique identifier assigned by Surefire when the field was created or enlarged. The command contained by the current cell is shown next to the label "Cmd:". You can edit field commands on the two lines labeled as "Edit:". This is called the edit area. Entering Field Commands You can enter a field command by typing the command into the edit area. Once the command is in the edit area, you put it in the current field or cell (whose ID is shown) by using a paste or paste & keep operation. These are the same paste operations that you learned in word-processing. Paste will put the command into the cell and clear the edit area while paste & keep will put the command into the cell but will not clear the edit area. Generally, paste & keep is used to put the same or similar commands into other fields. You will learn more sophisticated methods for entering and manipulating commands in the next chapter. Except for numeric fields, there can only be one field command per field. Each cell of a multiple line numeric field, however, may have its own field command. Executing Field Commands When a command is executed, it does what it was specified to do. If it is to add two numbers, then the numbers are added and the result is displayed in the numeric field containing that command. If, however, the command had a function to go to another page, execution would mean that Surefire would scroll the document to the specified page. Execution of a command can also mean putting the value of one cell or the result of some function into another cell in the document. There are various ways in which a command can be executed. The best way depends on the type of command and the size of the document. Commands can be executed individually or, all commands on a page or the entire document can be executed at the same time. Each of the methods of command execution will be discussed in the next chapter. If a command was specified incorrectly, Surefire will not know what you want it to do so it will fill the field with E's to indicate an error. The E's go away if the field is cleared or the command is corrected and re-executed. Specifying Functions Functions allow you to perform more sophisticated operations on field values than you can with operators alone. All functions in Surefire start with the special character "@". If a function uses arguments, these arguments are specified within parentheses and each is separated by a comma. Arguments supply the data or information needed by the function to do its job. The function @SQRT(n) requires one argument while the function @SUBSTR(text, start, len) requires three. Surefire User's Guide Page 88 To see which functions are available for building your commands you can display a pop-list of functions while the cursor is in the edit area of the Command Edit window. This is similar to the way you can list functions in the Calculator except here the functions are not just numeric functions. Type (ALT+Z) to display a pop-list of all available functions with placeholders for their arguments. You may scroll through this list to find the one you want. Typing (Enter) will cause the highlighted function to be put into the edit area starting where the cursor was when you typed (ALT+Z). You can then replace the dummy arguments with the right values or field IDs and continue. All functions available in Surefire are described in "Appendix A: Surefire Function Reference". Surefire User's Guide Page 89 Chapter 15 - Using Field Commands We introduced you to field commands in the previous chapter. In this chapter you will learn and practice more sophisticated concepts involving commands. These include viewing and editing existing commands, and formulating specific types of commands to do different tasks. Below is a list of topics that are covered. Viewing and Editing Commands IDs and References Tracing References Assignment Statements Multiple Statements Field Operations Control Operations More About Command Execution Viewing and Editing Commands You may view and edit field commands using the Command Edit window. As you saw in the previous chapter, this window is displayed by selecting "Commands.. " on the Field menu or by pressing (ALT+F10). Among other things, this window allows you to enter the actual command, view commands that already exist in fields, and copy similar existing commands to other fields. You can also give a field a more memorable name if desired. As you may recall, if a '#' is displayed at the far right of the status line, the current field or cell contains a command. This lets you know if a command exists without the Command Edit window being open. This is often very handy. IDs and Names Any cell in your document can optionally be named. When you give a cell a name, this name can be used instead of its pre-assigned ID. Giving a name improves the readability of expressions and database queries. For example, if A1 represented number of hours worked and B2 represented the hourly pay rate, the expression "A1 * B2" may now read as "hours * rate" after you name the cells A1 and B2. Note: A multiple line text field may have only one name for the entire field. You specify a field name by typing it in next to the label "Name:" in the Command Edit window. Surefire ensures that names are also unique within a single document. Names must begin with 3 lower case letters optionally followed by letters, numbers or an underscore (_). Examples of Names salary phoneline1 lease_date Surefire User's Guide Page 90 Viewing Field Commands Through the Command Edit window you can view every cell's command. To do this you move to the document while the Command Edit window is open. Once here, you may move around the document as usual, using the cursor movement keys. While the cursor is in the document, moving from cell to cell will cause the field ID and field command information in the Command Edit window to reflect the current cell. You may move the cursor to the document and back to the Command Edit window by pressing (Shift + Tab). Editing Field Commands In the Command Edit window, the command contained by the current cell is shown next to the label "Cmd:". You can edit field commands in the edit area which is to right of the two lines labeled "Edit:". To edit a command that is already in a cell, you use the Cut and Copy operations that you became familiar with in the Word Processing chapters. When the cursor is in the edit area, Cut (ALT+F1) will remove the command from the current cell and place it in the edit area. Copy (ALT+F2) will put a copy of the command into the edit area. Once the command is in the edit area, you may change it by using any of the text editing operations with which you are already familiar. Afterwards, you can put the command back in the cell by using a Paste or Paste & Keep operation. Paste (ALT+F3) will put the command into the cell and clear the edit area while Paste & Keep (ALT+F4) will put the command into the cell but will not clear the edit area. You can use Paste & Keep to put the same or similar commands into other fields. More than two lines are available for commands, however. If more room is needed, you can scroll the edit area. Up to ten lines can be used for field commands. When there is more text in the edit area than you can see, an arrow on the edit area's right side indicates the direction in which there is more text. You can use the arrow keys to access up to a full ten lines for more complex command statements. Say a cell has a rather complex command that actually takes four lines. Initially, the first line is next to the Cmd: label. The right-pointing arrow at the far right of this line indicates that there is more to the command than you can see. If you copy the command from the cell to the edit area and press (down arrow) to scroll down one line, the edit area will display lines 2 and 3 of the command. The up and down arrows at the far right of the edit area indicate that there is more of the command both before and after the two lines that can be seen in the edit area. You can use the (up and down arrow) keys to scroll the text in the edit area and access all of the command. Surefire User's Guide Page 91 The command in the edit area of the Command Edit window can also be edited when the cursor is in the document. When the Command Edit window is open and the cursor has been moved to the document by pressing (Shift+Tab), you can move through the document without altering either the document or field values. The characters that you type at the keyboard will be put directly into the command edit area. As you move around in the document, you can "point" to cells that you want in your expression in order to obtain their IDs. That is, you can enter the ID of a cell by pressing (Ctrl+Enter) when the cursor is on that cell. This is especially useful for building expressions based on fields in the document whose IDs you do not know. Pasting Values From the Calculator If you display the Calculator while the Command Edit window is opened, you may enter the result of your calculation directly into the edit area. Just use the Calculator as described in Chapter 10. When the result you desire is in the result area of the Calculator, choose PASTE. The value will be entered into the edit area of the Command Edit window at the current cursor location. IDs and References As you recall, a field ID is automatically assigned by Surefire when a field is created and is guaranteed to be unique for the document. This ID is used in commands to reference or represent each individual cell in a document. IDs consist of one or two capital letters optionally followed by one or two digits. The letters describe a field uniquely while the numbers identify the line or cell within the field. A simple use of referencing is to take the value in one cell and display it in another cell. If the fields L and M are the same data types, the value in L can be displayed in M by defining "L" as the command for M. When the field command in cell M is executed, whatever value is currently contained in L will be displayed in M. A field ID can also be used to reference an entire field whether it is a multiple or single line field. This is done by using only the letter prefix of the ID. Since date, and logical fields can only be single line or have one cell, the letter prefix, with or without the digit '1', can be used interchangeably. The digit part is usually dropped. For example, if a date field is C, then either C or C1 can reference the field. The same holds for single line text and numeric fields. There are different rules for referencing numeric versus text multiple line fields depending on what you want to happen. In some cases you can use the complete field ID and in others you use the letter prefix only. These differences are described later in the sections on numeric and text fields. Surefire User's Guide Page 92 Ranges A range is a way of specifying a group of fields or cells. You specify a range by typing the ID's of two fields or cells with a colon (:) between them. These two cells define a rectangle in which all cells that are completely contained within the rectangle make up the range of cells. The first cell is the upper left corner and the second cell is the lower right corner of this rectangle. If multi-lined fields are used to define a range, you must specify the individual cells that bound the rectangle. Ranges can be used to copy commands or assign values to more than one field at a time or as a short-hand way to indicate a numeric sum. Range Example 1 Say you have two 3-cell numeric fields called A and B that are side by side. A1 B1 A2 B2 A3 B3 The range A1:B3 contains all 6 cells. Because A and B are multi-lined fields, A:B is not a valid range. Range Example 2 Say you have four single cell fields: Q, R, S, and T positioned like this: Q S R T Q:T represents the range of the four fields. Note: All the cells of a range must be on the same page. That is, ranges cannot span pages. Numeric Fields You use the complete field ID to reference a specific cell of a numeric field. This is done by specifying the cell number as part of the ID. For example, if we have a 3-cell numeric field called A, each cell is referred to as A1, A2 and A3. When used in a command, each of these references correspond to the value contained in each cell of field A. Sum of Numbers For numeric fields you may use only the letter prefix of a field ID by itself to imply a sum of all the cells in that field. This is convenient way to do the very common operation of summing groups of numbers. Surefire User's Guide Page 93 Shorthand Summation 1 If field D contained the cells D1, D2, D3, D4, and we put just D as a field command for field B, B would display the sum of the numbers in D, or "D1 + D2 + D3 + D4". You can also use a reference to a range of numeric cells to indicate a sum. Shorthand Summation 2 If there are two 3-cell numeric fields, A and B, side by side, the sum "A1 + A2 + B1 + B2" can be expressed as the range "A1:B2". The command A1:B2 can be put into field C to display the sum. Note: Text fields and date fields within a range are ignored, however the range must be specified by two numeric (or logical) cells. Logical fields with a True value will have the numeric value 1. Logical fields with a False value will have the numeric value 0. Text Fields When you use only the letter prefix of a text field, you will be using or setting the value of the entire field. You may reference an individual line of the field if you are interested in the text in that particular line. For text fields the number part of the ID corresponds to a line. number. This is useful when you want to assign a string value to a specific line of the field. Or, you may want the text of a given line only to be used in a command. Note: If the string does not fit in the particular line of the field, it will be truncated. Truncation means that the part that does not fit will be lost. The following example shows how text fields can be referenced. Text field M has 3 lines: M1, M2 and M3. M is 12 characters wide: M1 "first line " M2 "second line " M3 "third line " The command M2 = "this is a happy day" sets M2 to "this is a ha". The command C = M3 would set the value of the single line field C to the text in M3 or the third line of field M. That is, C would get the text "third line". If C were 36 characters wide, the command C = M would set C to "first line second line third line" or the text from all lines of M strung out end to end. But if C were an 18 character 2 line field, the command C = M would put all three lines of M into the 2 lines of C. Surefire User's Guide Page 94 Tracing References Sometimes you may have a rather complex expression in your field command with references to various fields. It then becomes difficult to know which field in the document corresponds to each reference in this command. Surefire alleviates this problem by allowing you to highlight the cell in the document that corresponds to a reference. This is called tracing. Tracing will work for references by field ID and references by field names. To trace a command you can use (Ctrl + N), (Ctrl + P) and (Ctrl + T) while the cursor is in the edit area of the Command Edit window. Pressing (Ctrl + N) will cause Surefire to scan the command string, find the next reference to a cell in your document, then scroll the document and highlight the corresponding cell. By looking at the context of the cell in the document and how that cell is used in a command, you have better control of your field commands. (Ctrl + P) will scan the command backward instead, looking for the previous reference. And, (Ctrl + T) will locate the reference that is at the cursor. To Highlight Press The next reference Ctrl + N The previous reference Ctrl + P The current reference Ctrl + T Assignment Statements Normally, the result of a command in a field or cell is displayed in the field or cell that contains the command. Sometimes you may want to put the result elsewhere. This is done by assignment. The following table lists the types of assignments that may be used in field commands. Assignment Form Meaning cell = n Numeric Assignment - Put n in field. field = date Date Assignment - Put date in date field. field = string Text Assignment - Put string in text field. cell = string Text Assignment - Put string in specific line of text field. range = n Numeric Range Assignment - Put n in all numeric cells in range. range = date Date Range Assignment - Put date in all date fields in range. range = string Text Range Assignment - Put string in all text fields in range. Implicit Assignment You use implicit assignment (no '='), to put an expression or function result into the cell containing the field command. When you have a field command without an assignment, the result of the command will be entered into the same field or cell that contains that command. Surefire User's Guide Page 95 Explicit Assignment To a Field You use explicit assignment (with an '=') to put the result of an expression somewhere explicitly. Assignment is done by specifying the ID or name of the cell or field into which you want a result put, followed by "=", which is then followed by the command expression. For example, "A = B*10" will multiply the value of B by 10 and put the result in A. Assignment To a Range of Cells Assignments can also be made to a range of cells. This is done by using the range operator ":" to describe the range, followed by an equal sign '=', which is then followed by the command expression. For example, if you want all cells in the range A1:D3 to be cleared to zero when button X is pushed, the command in X would be "A1:D3 = 0". Multiple Statements Occasionally you may want to put more than one expression or statement in a command line. All of these statements will be evaluated before evaluating the command in another cell. To have multiple statements, separate each statement with a semicolon ';'. There must be no semicolon after the last statement. If a field command with multiple statements uses implicit assignment more than once, the result of the last such command will be displayed in the cell. Operating with Numbers Mathematical expressions result in numbers which are usually displayed as values in one or more numeric fields. They can also be used in some cases as arguments to functions for other data types. As discussed earlier in the Calculator chapter, mathematical expressions are generally created from numbers, numeric operators and functions. Surefire supports the following numeric operators: Two number operators One number operators + Addition - Negation - Subtraction * Multiplication / Division Numeric field commands include simple expressions like 54 * 10 and expressions that contain field references, like (A - 45)/B * 100. In the second expression, A and B represent the numbers that are contained in other numeric fields with IDs of A and B respectively. Numeric commands can also contain functions. For example, @PI * A * A calculates the area of a circle where the radius is the value in the field called 'A'. @PI is a function. Surefire User's Guide Page 96 There are general mathematical functions including one to obtain the absolute value of a number and one that determines a number's square root. There are trigonometric functions like @SIN and @COS and logarithmic functions. There are also financial analysis and statistical functions. All numeric functions are also available in the Calculator. They are all completely described in "Appendix A: Surefire Function Reference". Operating with Text While numeric expressions result in a number, textual expressions result in a string of text. This implies that a textual expression can be a field command for a text field. The simplest text expression involves concatenation. Concatenation is as simple as adding two numbers together but instead it combines two text strings into one by putting one after the other. The operator "&" is used for concatenation. Example Joining Strings The two strings "foot" and "ball" can be concatenated with the command "foot" & "ball". When executed, the single string "football" will be the result displayed in the text field. Any string can be specified in a command by being in quotation marks. This is called a string constant. Let's look at another example of operating on text that will combine concatenation with field values and string constants. Suppose you wanted to construct a sentence like "Big girls " where some information was already set and some could be filled in. Another Example Joining Strings Let's set things up so that you can specify the third word of the sentence in a separate field. We will enter the missing word in text field A. Text field B will display the resulting sentence. To do this, you put this command into B: "Big girls " & A & "." The resulting string is the concatenation of 3 strings; one from another text field, A, and two from within the command itself. Notice that the period '.' which ends the sentence is a string. Surefire provides many text functions to manipulate text values. The result of a text function or at least one argument is a text string or reference to a text field. For example, the function @SUBSTR() finds a string within a string (or substring), of a given text field or text constant. If field R has the value "mission", the command @SUBSTR(R, 0, 4) would result in the string "miss". Surefire User's Guide Page 97 Some text functions yield numeric results which can be used in mathematical expressions. For example, the function @LENGTH(string) returns the number of characters in a string. This number can then be divided into 80 to see how many times the string would fit on a line of a page. Likewise, if a text function required a number as an argument, this argument can be any mathematical expression. All text functions are described in "Appendix A: Surefire Function Reference". Conditions and Logical Expressions You use a condition to do some action or assign some value "IF" something is either true or false. For example, in calculating your taxes, you would want the amount owed to always be zero if you had a loss. Alternatively if you made a profit then you would make sure that the amount owed was some number greater than zero. Logical expressions are used to determine the value of a condition or a value to be displayed in a logical field. They always yield the result of True or False. If the value is displayed in a logical field, it will be in one of the 4 formats that you had chosen for that field. The table below shows what will be displayed in a field. Format Display if True Display if False Y/N Y N On/Off On Off YES/NO YES NO True/False True False Any mathematical expression can be a logical expression. This is because the value zero is always defined to be the same as False and all other numbers are defined to be True. After you know how to enter field commands, you can verify this with the following exercise. Create a numeric field A and a logical field B. Put the command "A" in the field B. When you type 0 in field A, you will see the word "False" or "No", etc. displayed in B. Any other number will produce the opposite result. A logical value can also be explicitly defined by using the functions @TRUE and @FALSE. These are in fact equivalent to using the numbers 1 for True and 0 for False, but are much more readable. Logical Operators Logical values can result from logical expressions which are constructed by using logical operators and possibly logical functions. Surefire supports the following operators: Operator Meaning = Equal To < Less Than < = Less Than or Equal To Surefire User's Guide Page 98 Operator Meaning (cont) > Greater Than > = Greater Than or Equal To <> Not Equal To Note: These operators require a number or mathematical expression on either side of the operator in order to be evaluated. Examples of Logical Expressions age < 50 balance < = 0 emplnum = 468 Complex Logical Expressions You can make even more complex logical expressions by using the logical operators #AND# and #OR# to combine logical expressions together. You can also use an additional operator #NOT#. This takes the logical expression right after it, evaluating it as if it were just the opposite. True expressions are looked at as False and vice-versa. Examples of Complex Logical Expressions salary < 15000 #AND# dept <> 15 age > 60 #OR# weight > 200 Logical Condition Function A logical condition function does something different based on whether the given logical expression is True or False. To do this there is a special function: @IF(condx, true, false) The condition condx is a logical expression. If condx evaluates to True, then the function specified as the argument true is executed, otherwise the condition must be false, so the function specified as the argument false is executed instead. Logical Condition Function Example Make sure a negative tax is never calculated. Assume we have a simple tax rate of 10% and the following command: @IF( A1 > 0,A1 *.10,0 ) Surefire will take the value in cell A1, the income, and see whether it is greater than 0. If it is, it is multiplied by .10 to give 10 percent of it. Otherwise, the result is set to the third argument, zero. Note: Multiple statements are not supported within @IF functions. Surefire User's Guide Page 99 Control Operations Control operations are field commands that cause some action to take place. These actions include moving to a particular page or field of your document, and displaying a different document altogether. Control functions are functions that perform an immediate action. Because the result is an action, these functions are generally used with button fields or in commands with the Execute on Enter prefix "[". You can even use button fields and their commands to do such things as pass a field value between documents. There are various types of control functions. There are functions to run a DOS command from a Surefire document, to define help contexts for your own Surefire applications and to display Surefire document screens one after the other as an automatic presentation. All control functions are fully described in "Appendix A: Surefire Function Reference". The following sections discuss topics that are important when using control functions. Errors in Control Functions Control functions generally return a logical value. If this is a True value, the function was executed as expected. If a False was returned, there was some sort of problem. A False returned from an @GODOC, @RETURN, or the database control function @JOIN will stop execution of the remaining statements for that command string, if there are any. For all other control functions, Surefire will display "COMMAND ERROR" in the status line but will attempt to continue processing the remaining statements of the command. Document Levels Some control functions cause Surefire to display a different document than the one currently displayed. These functions are @GODOC, @RETURN, and the database command function @JOIN. Each time @GODOC or @JOIN is successfully executed, Surefire displays a document. This document is considered to be at a new document level. You return to the document at the previous level by executing @RETURN or by indicating an implicit return by pressing (Esc). The @RETURN function also has an optional argument that allows you to return by more than one level. This will skip the display of intervening documents. Surefire maintains the hierarchy of document levels until you exit Surefire or explicitly read a document by choosing Get or New from the File menu. Changing Directories The same control functions that affect document levels may also cause Surefire to change directories. You can specify that a document named in an @GODOC or @JOIN command is in a different directory by specifying "name" as a relative path name. When the @GODOC or @JOIN are Surefire User's Guide Page 100 successfully executed, Surefire will change directories prior to looking for and reading the document. Once the document is displayed, all references to other documents are expected to be in the new directory just as if you had used the Setup window to change the directory. One difference between changing directories this way and using Setup is that you will eventually return to a document in the original directory. You will return to the previous directory when you return from the first document that you displayed in this other directory. More About Command Execution There are various ways in which a command can be executed. The best way depends on the type of command to be executed and the size of the document. Sometimes you may desire to have an individual command executed by pressing a button or after entering a value. Another application may require you to occasionally recalculate all the commands within the document. For large spreadsheets, you want to recalculate only the commands on the page on which you are working. You may also choose to have Surefire execute commands in a vertical or horizontal order. The following sections discuss the four methods of execution, horizontal versus vertical ordering, and what happens if Surefire cannot execute a command. Automatic Command Execution When commands are executed automatically, all commands within the document are executed whenever the value of any field is changed. It is necessary to execute all of them since other commands may depend on the value that was just entered. When the document is small or the information within fields is changed infrequently, this is a very satisfactory way to assure all calculations are current. This feature can be turned on or off by choosing "Auto Calc" on the Field menu. In addition, you may select an option in the Setup window to have auto calc be set by default whenever you use a Surefire document. An "X" on the menu indicates that auto calculate is on. Note: When Auto Calc is not on, and values have been changed in the document, a 'C' is displayed at the far right of the status line. This indicates that a recalculation needs to be performed. Explicit Execution by Page or Document When Auto Calc is off, you need a way to tell Surefire to go ahead and do the calculations. You can specify that either all commands on a single page, or that all commands in the document, are to be executed. All commands contained in fields on the currently displayed page can be recalculated by pressing (F9). Since you normally work on one page at a time, this is convenient and requires comparatively little processing overhead. You can also force the calculation of all Surefire User's Guide Page 101 non-immediate commands within the document by choosing "Calc All" on the Field menu or by pressing (Shift + F9). Immediate commands are those that are in button fields or those set to Execute on Enter (see below). Non-immediate commands are all others. Execution by Buttons Button fields have their own rules about when their commands are executed. When you push a button, be it a doorbell or a button within a Surefire document, you expect the action performed to be immediate. In the case of the doorbell, a sound is made. In the case of a Surefire button, the command is executed when you press (Enter). Execute on Enter Sometimes you may want to have a command executed just after information is entered into the field or cell containing the command. This is similar to the way buttons behave. To do this, you prefix the command by a special character '[' (left bracket). When a [ is the first character of the command, Surefire knows to execute the command when you change the data in the field. This command will not be executed at any other time. To tell Surefire that you are changing a field value, you first type or select the new value. You then enter the value by pressing (Enter) or by moving the cursor off of the field. For example, putting the command [ @GOPAGE(5) in a numeric, date, text or logical field will display page 5 of your document when you enter a value in the field. Order of Execution When you execute commands by page or document, the order in which the fields are traversed and the commands executed may affect the results of some calculations. If you understand this order, you could prevent getting improper results. Usually commands are executed is the same order that you read text on a page. That is, from left to right and down or horizontally. This is a natural way to look at information in many Surefire documents. Sometimes, especially in spreadsheet-like applications, you want to think of things in columns arranged from left to right. If this is the case, it might be more appropriate to have Surefire execute commands on a column by column basis or vertically. You will learn how to specify this distinction in the following chapter entitled "Spreadsheets". Command Errors If you specify a command incorrectly, Surefire will not know what you want it to do so it will fill the field containing the command with E's to indicate an error. In addition, the status indicator "COMMAND ERROR" will be displayed for a few moments in the upper right corner of your screen. The E's will go away if you clear the field (press Ctrl+K) or correct and re-execute the offending command. Surefire User's Guide Page 102 Chapter 16 - Spreadsheets In Surefire, it is not necessary to lay out your fields to look like the rows and columns of a conventional spread sheet. As you have seen, you can have fields anywhere within a document page, embedded in text paragraphs or not. Sometimes, however, you may want to use fields that are arranged in rows and columns. This is especially useful in accounting applications such as expense reports, budgets and cash flow statements. In this chapter, you will see how to create fields that present a tabular view of information normally called spreadsheets. Of course, the "what-if" analysis is naturally supported by Surefire's field commands and methods of command execution. Creating a Spreadsheet To create a spreadsheet in Surefire you first create the number of multiple line numeric fields that you desire. Each multiline field represents a column and each line of field cells represents a row. For example if you want to create a 10x10 spreadsheet, you would create 10 multiline numeric fields that are side by side. Each of these fields should have 10 cells. If you desire, you can label the columns A, B, C, .... J, and the rows 1, 2, 3, .... 10 by editing the document. Once you have a spreadsheet document like this, you can save it and use copies for various purposes. You can put commands into any or all of the cells in your document to do your analysis. Using a Spreadsheet Once you have a document with fields that are laid out as a spreadsheet, you use it the same way that you use any document in Surefire. You give the cells of the spreadsheet any desired field commands, enter field values as needed, and press (F9) to execute the commands and compute your results. Absolute and Relative References A command can be copied from one cell to another by using Cut & Paste as described in the previous chapter. Normally these commands are copied exactly as they are. But often you find, especially in spreadsheet-like applications, that you need the exact same formula in many cells with only the references changed by some regular means. Surefire and many spreadsheet programs handle this by using the concepts of absolute and relative references. Unlike other spreadsheet programs, Surefire's default is to use absolute referencing. This is because, in most instances, Surefire fields are laid out in a non-tabular way, making absolute referencing more natural. The best way to understand the difference between Absolute and Relative references is to describe the location of someone's house in two ways. If you say that George is at "123 Main Street", you are giving Surefire User's Guide Page 103 the absolute location of his house. No matter where you are, the location you are talking about is the actual location of his house. On the other hand, if you say he is "3 blocks north of here", you are describing where he lives relative to where you are now. Keeping this in mind will help you in the following discussions. In Surefire, the terms Absolute and Relative only have meaning when a command is put in a field. Absolute means that the reference remains exactly the same no matter where a field command is copied. Say you have fields A, B, C and D and cell A1 has the command B1 + C1. If you copy this command to D using absolute referencing, the command in D will be exactly the same or B1 + C1. When references in a field command are made relative, copying the command will adjust the references in a prescribed way. This adjustment is done based on the relative position of the cell containing the original command to any cells referenced relatively in that command. Let's say you have four multi-celled fields, A, B, C, and D horizontally on the screen, each separated from the other by the same distance. If C1 has the command A2 + B2, and you copy this command to D1 with relative referencing, the resulting command in D1 will be B2 + C2. This is because A2 and B2 are at the same relative position from C1 as B2 and C2 are from D1. Loading Commands with Relative References If you copy fields in Document edit mode, the field commands for the new fields will be cleared while those of the original fields remain unchanged. To copy the field commands you must use the Command Edit window. When you copy commands, you have control over how the commands are copied. You can copy commands relatively provided that the destination field cells already exist. A relative copy is set up as follows: You position to the cell that has the desired command and open the Command Edit window. Then, copy the command from that cell into the edit area. Now, set the "Absolute/Relative" multiple choice button to Relative. Notice that the ID of this cell appears to the right of the button. This tells Surefire that all subsequent pastings of this command into other cells will be done relative to the cell from which you copied the command. As you copy this command into other cells, all the references of the command will be adjusted accordingly. This will continue until you either toggle the button back to Absolute, Paste the command in a cell or change the command in the edit area. If you want to make a relative copy of a command into more than one cell, use Paste & Keep instead of Paste. The references will be adjusted for each cell until one of the above conditions happen. Note: If there is a relative reference that can not be adjusted to an actual cell in your document with respect to the destination field or cell, the absolute cell reference will be copied to that field or cell. Surefire User's Guide Page 104 Vertical and Horizontal Relative References Let's think about the analogy of where George lives one more time. Suppose we say George is "3 blocks north on Main Street". Main Street could be east or west of us but that doesn't matter because we have described its absolute location. However, "3 blocks north" is still relative to where we are. We gave a relative vertical (eg. north/south) direction and an absolute horizontal direction (eg. Main Street is either east or west). You can do the same with Surefire fields. Now suppose you want some references to be relative and some to be absolute. This may be desirable when you copy formulas that contain some "constant" values that should not change no matter where the formulas are copied. For example, suppose we added a field E to our spreadsheet. The value in E needs to be added to each of the commands in all the other cells. When you copy A2 + B2 + E relatively from cell C1 to cell D1 you want to end up with B2 + C2 + E. Alternatively, suppose you want a reference to be relative only in one direction. A reference that is relative vertically and absolute horizontally results in the copy being adjusted to a cell that is vertical to the cell with the copied command. This vertical distance is the distance of the original cell to its original vertical reference. Likewise, a reference that is relative horizontally and absolute vertically results in the copy being adjusted to a cell that is horizontal to the cell with the copied command. This horizontal distance is the distance of the original cell to its original horizontal reference. To limit how Surefire does a relative copy, you use dollar signs ($) in the part of the reference that you want to keep absolute. The following table shows the four possibilities of referencing for the cell A1. Other cells such as BQ12, A5, etc. change in a similar way: Cell Reference Meaning A1 Relative both vertically and horizontally $A1 Relative vertically only A$1 Relative horizontally only $A$1 Absolute Note: The use of dollar signs ($) only applies when you are doing a relative command copy That is when the button in the command window is set to Relative. If the button is set to Absolute these specifications are ignored and an absolute copy is done in all cases. Note: Changing the reference type will not occur with named references but only with Surefire's unique field ID's. Surefire User's Guide Page 105 Absolute/Relative Toggle Key You can enter the dollar signs by typing them at the appropriate locations in the cell reference as shown above. There is, however, a more convenient way to change reference types from within the command edit area of the Command Edit window. With the cursor over the reference to change, press (F4) successively to go through all four combinations of references. This is known as the absolute/relative toggle key. You can use the Absolute/Relative toggle key to make a reference relative in the vertical direction only. This means that the letter part of the reference will stay the same but the number part will change. Enlarging A Spreadsheet Since Surefire fields are not constrained to a fixed row and column grid, you need an easy way to enlarge your spread sheet. Using a combination of techniques that are available for manipulating fields, you can easily enlarge your spreadsheet by switching to Document Edit mode and enlarging each of the multi-lined fields. At the same time you may create additional fields for your spreadsheet. Using a Range of Fields When you want to load a command with relative references into many cells, putting it into each cell one by one would be a tedious task. You can accomplish this very quickly by first selecting a range of fields and then doing a Paste operation on the command. Selecting a Range of Fields Range selections are initiated by choosing the "Field Select Alt+J" menu item on the Edit menu while you are in Use mode and the Command Edit window is displayed. (Conversely, the Block selection you did to enlarge the spreadsheet was done during Document edit. ). If the cursor is free, all cells that are completely contained within the bounds of the start position and the current cursor position become selected. The selection occurs as the cursor is moved down and to the right with the arrow keys. The range shrinks when the cursor is then moved up or to the left. If the cursor is not free, a rectangle of fields are selected corresponding to the left corner of the cell in which the selection was started and the right corner of the current cell. The selection occurs as the cursor is moved down and to the right with the arrow keys or with a combination of (End) and (down arrow). The range shrinks when the cursor is then moved up or to the left. In either case, as with any selection in Surefire, if you move the cursor to the left or above the initial cursor position, the field selection operation is canceled. You can also cancel the operation directly by pressing (Esc). Surefire User's Guide Page 106 Copy Commands Using Range Selection To copy commands using range selection you first must set the original command. Move to cell one cell of your spreadsheet and press (ALT+F10) to open the Command Edit window. Enter the command to be copied in the edit area and press (ALT+F4) to Paste & Keep it. Now, Press (Home) to move to the Absolute/Relative button and press (Spacebar) to make the command Relative. Define the range by pressing (Shift+Tab) to go back to the document. Move the cursor to the upper left-most cell to receive the adjusted command. Choose "Field Select" from the Edit menu or press (ALT+J) to start Field selection. Move the cursor to the lower right-most cell. These cells will be the destination of the pasted commands. Press (ALT+F4) to paste and keep the commands. If you now look at the commands in the cells you will see that each has a similar command with the references adjusted according to their position. Horizontal vs Vertical Execution Order The order of execution determines whether field commands will be calculated in a row by row (i.e. horizontal) or column by column (i.e. vertical) order. This order may affect the resulting values in your fields because some expressions may depend on field values already being known. If these particular fields are above, below, to the left or right of the field containing the command then the execution order may affect your results. The default order in Surefire is horizontal but it is up to you to determine the best order for your needs. You can change the order of execution on a page by page basis. To do this, you use a multiple choice button located in the Command Edit window. This button displays the current execution order as either Vert or Horiz corresponding to a vertical and horizontal order respectively. You toggle this button to set the execution order for the current page. It does not matter what the current field is when this button is set. All fields on the same page will have the same execution order. Surefire User's Guide Page 107 Chapter 17 - Introduction to Databases Any Surefire document that has fields has data associated with those fields. Data is simply the values contained in Surefire fields. In the simplest sense, the current values of fields are saved automatically with a document when you save the document. So one set of data, the displayed field values, is always associated with a document. This set of data is known as a data record or simply a record. Sometimes you may want to work with more than one set of data. Being able to do just that is the basic idea of a database. You generally keep sets of similar information about something in a database. In many ways a database is like a file cabinet. It may contain folders of information about each of your clients, recipes, employees, patients, suppliers, etc. For each employee, you may keep personal information including their name, address and social security number. For each recipe, you might keep a title and list of major ingredients. And for your rental property, you will want to easily access information about all tenants and leases. To define a database in Surefire, you indicate those fields of your document which are to contain more than one value. That's all there is to it! Surefire will automatically create your database! You can now add, change or delete records at any time. After records have been added, you can selectively look at specific records. In this and the following two chapters you will learn how to manipulate data records and how to find the ones in which you may be interested. In addition, you will learn how to calculate information and generate statistics based on your stored data. You will also learn how to enlarge fields that are too small, add additional fields, and remove fields that you no longer need. Later, in the chapter "Generating Reports", we will expand on these concepts so that you learn how to look at and print multiple data records at one time with a Surefire document. Storing Data Naturally, the first thing that you will want to do is to create a database and start adding information. In Surefire, the creation of a database is as simple as creating a field and adding your first data record. You will see a natural progression from storing a single data record directly in a document to storing many data records in a database. Specifying a Database Field The values of all Surefire fields, except buttons, may be stored in a database. To indicate that a field's data is to be stored in a database, you must set or modify the data attribute for that field using the Create Field or Modify Field windows. To do this you must be in Document Edit mode. If the field already exists, select Modify from the Field Menu or press (ALT+M). Otherwise, for a new field press (ALT+C). Press (End) enough times to move the cursor down to the multiple choice button just below the heading Data. It should indicate "Not Stored". Surefire User's Guide Page 108 Press (ALT+Z) to display the button's pop-list and highlight "Stored". Press (Enter) and then (Ctrl + Enter) to set the change. You need to set the choice to Stored for each field that you wish to store. Since button fields do not contain data, they cannot be Stored. When all fields are properly set, you can proceed to add data to your database. When you add your first record in the manner described in the next section, Surefire will create your database automatically. You may add other fields to your database at a later time. Note: Each cell of a Stored multiple cell numeric field is stored separately in the database. Database Limits The visible size of your field generally determines the maximum amount or value of Stored data that field may contain. However, while non-stored text fields may have up to 4096 characters, a Stored text field may have no more than 254 characters. Likewise, the maximum size of a Stored numeric field is 16 characters wide. Various field formats may remove available characters from the visible field. For example, the value that a numeric field can contain is limited by the formatting specified for that field (eg. Currency format, number of decimal places, etc.). No matter which format you have chosen to display logical fields, they can have only 2 possible values: 'T' or 'F'. While Stored dates may range from year 1 thru year 9999, a century other than 1900 may only be entered in long date format. Even in long date format, if you use indexed or sorted searches to retrieve records, dates before Jan 1, 1900 or after Dec 31, 1999 will not be correctly ordered. The current century (ie. 1900) is assumed for the other date formats. Note: You may designate up to 128 stored fields in a document. Adding a Data Record You can add your first record to a database once you have given a name to your document. This means you must first save a new document (to give it a name). Existing documents already have names. Surefire uses this name to create a separate place to keep the data records associated with the document. You can then enter values into fields and store these values. You can add records as long as you have enough disk space. Remember that some fields have field commands in them to calculate their values. Field commands are automatically executed before a record is added to the database so that any stored fields with calculated values will have their correct values stored. In order not to waste time typing a value in a "calculated" field, you can usually skip fields when an '#' appears at the far right of the status line. Surefire User's Guide Page 109 To add a record, you must be Using your document. Now, enter values into the fields you want stored in the database. Choose "Add Record" from the Data Menu or press (ALT+A). You have now added a record into a newly created database. Clearing All Fields You can clear the values of all the fields in your document to start afresh by choosing "Clear Fields" from the Field menu or pressing (ALT+Y). This will not affect data records stored in the database. If much of the information is the same from record to record, do not use this option and simply enter new values in only those fields that should have different values. Simple Data Search Now that there are records in the database, you will want to look at them. There are two simple ways that your data records may be retrieved. You can view each of the records in the same order that you added them to the database. Or, you can enter a value in one field and tell Surefire to display all the records that have that same value. In the next chapter, you'll learn more complex ways to retrieve your data. Before you start a search, you should Get the document that you used to add your records, if it is not already displayed. Since the document fields will be used to display the values stored in the database, you should also be Using the document (i.e. in Use mode). Viewing All Records The simplest way to look at your data is to retrieve your records in the order that they were added to the database. This is done by pressing (F8) (i.e. Next Record). The first record that was added will be displayed in your document. You can continue to press (F8) to view each successive record until you hear a beep. As each record is displayed, Surefire will also calculate the values of fields that are Not Stored. You may reverse the direction of the retrieval by pressing (F7) (i.e. Previous Record). When you again see the first record, another (F7) sounds a beep to indicate that you can't go any farther. Note: If you add a record while viewing database records, that record will be appended to the end of the database and will become the currently displayed record. Database Status Information As each record is retrieved from the database, Surefire gives you important status information. When you press (F8), the status line showing the current document name and the current cursor position will change to show that a record is being displayed. Surefire User's Guide Page 110 The "1" means that you are looking at the first record and the "?" means that Surefire doesn't know at this point how many records you will eventually see. As each successive record is displayed, the "1" becomes 2, 3, etc. When all the records have been displayed, the "?" will be replaced to show how many records have been displayed. When you are finished looking at these records, the normal status information (i.e. document page, line and column) can be redisplayed if you press (F3). Getting Specific Records You have just seen how to retrieve all the data records, one by one, from the database. You may, however, want to look at certain records only. This is especially true when your database becomes large. To do this, you can start a search based on a specific document field. For example, you may be interested in all persons named "Smith", or all children aged 10, or all recipes that call for chicken, or all invoices with payment due dates of 01/15/90, etc. You qualify or weed out these records by giving the conditions that the desired records must match. Once you have set your search conditions, you can start a search. You specify the simplest kind of condition by entering a particular value in any single stored field. You then choose "Search" from the Data menu to start the search based on this condition. The status indicators "INDEXING" or "SEARCHING" may appear at the right side of the status line until the search is finished. If you see the status indicator "NOTHING FOUND", there are no records in the database which match your conditions. Text field conditions are even more powerful. Typing only a few characters in the field will match records where the field begins with those characters. If the field is blank, Surefire will find all records sorted alphabetically by that field. And, to make things even easier, case is not important in database searches. When you start a database search, Surefire will process all records, display the first one that matches, and display the total number of matching records instead of a '?'. You will learn more complex techniques for qualifying data records in the next chapter. Updating a Data Record Once you retrieve records from the database in one of the manners described above, you can change their values. You first display a record that needs to be corrected. After you make all desired changes, choose "Update Record(s)" from the Data menu or press (ALT+U). The status indicator "RECORD UPDATED" will appear briefly at the right of the status line. Your changes will be reflected the next time that record is displayed. Repeat this procedure for any records that need new values. If you change values in stored fields and try to leave Surefire or Get another document, Surefire will warn you with a message window to update or add the currently displayed data record. Choose YES if you don't care about saving the field values. Choose NO if you want a chance to add or update the record before moving on. Surefire User's Guide Page 111 Deleting a Data Record Normally the records you can see are active records. You can delete a record or make it inactive if you want Surefire to ignore it when the database is searched. You do this in a similar manner to the way you update a record. The record you wish to delete must be currently displayed in the document. You then choose "Delete Record(s)" from the Data menu or press (ALT + F5). That record will now be marked as inactive and will not appear the next time that records are displayed as a result of a search. The status indicator "RECORD DELETED" will appear briefly at the right of the status line. If you were currently looking at successive records (i.e. pressing F8, F8...), the next qualifying record will be displayed after you delete a record. If you delete the last record from your search, all fields in the document will be cleared. Likewise, if you were looking at records in reverse order (i.e. pressing F7, F7...), the previous qualifying record will be displayed. In this case, if you delete the first record from your search, all document fields will be cleared. Note: In Surefire, a deleted record is actually not deleted but is marked inactive. This means that while these deleted records are not normally displayed, you may at some point access them and restore them to active status. You must perform a restructure operation to remove deleted records permanently. You will learn how to recall records and restructure a database later in this manual. Surefire User's Guide Page 112 Chapter 18 - Searching a Database You have already seen how to access all records one at a time from the database. You also know how to limit the set of records based on matching a single field value. Because some situations require more complex data filtering, Surefire allows you to specify more complex conditions to qualify which records are retrieved. Say you want to find all of your contacts in a certain city. Perhaps you would also like these records to be displayed alphabetically by the last name of each contact. You describe this as a query. A query is a set of conditions that restrict the data records that are retrieved from the database and give a specified ordering of their display. A query is used to search the database. The records resulting from the search make up a record set. You can look at or print the records in a record set as well as update or delete them as a group. Working with a record set as a group will be explained in "Chapter 21: Advanced Database Topics". In this chapter you will learn how to specify queries and save them for later use. You will also see how to display records that were previously "deleted". Specifying a Query To specify a query, first make sure you have your document in Use mode. You then position the cursor on the field whose value you think would most limit the initial search. This is sometimes called the key field or the primary key. Now suppose you have about 200 contacts, most of whom live in one of five cities. The city field might be a good choice as the key field since only about 20% of your contacts are likely to live in a given city. Of course, any field that is stored in the database can be used as a key field. In fact, you may use different keys at different times depending on the type of record you are looking for. Once you have chosen a key field and have positioned the cursor to it, choose "Build Query..." from the Data menu or press (ALT + Q). This will open the Query window. The Query window appears as a pane at the top of your screen, like the Command Edit window, and does not obscure the document. When you specify a query in the Query window, a 'Q' will appear in the status line to the left of the document name. This 'Q' means that you are specifying a new query. Therefore the current record set that you are viewing using (F7) and (F8) do not correspond to the new query. After you do a search based on this query (eg. by pressing ALT+S), the 'Q' will be replaced by an 'S'. This indicates that the database was searched according to the current query in the Query window and that the current record set now corresponds to the query. Surefire User's Guide Page 113 Query Lines Once you display the Query window, information about your field is on the first line of the window. So that we can refer to it more easily, let's call this a query line. Each query line represents a single condition. A query can have up to 20 query lines. As with any window in Surefire, you use the (Home), (End) and (left and right arrows) to move between query lines and query line items. You will now learn about each item from left to right. Sort Order Multiple Choice Button The sort order multiple choice button can have values 1, 2 or blank, to indicate how the retrieved records will be sorted. Sorting is the order that Surefire will use to display the records as they are found in the database. Initially when there is only one query line, this value is 1. That means, if no other conditions are added, the data will be sorted on the field associated with this query line. For example, if we chose the city field of a "contacts" document and the query said to search for all contacts, the records would be displayed in alphabetical order by city. That means you would see the records for people in Boston before those for Dallas which would be before those for Denver, etc. If you add another query line, you can give it a sort order of 2. This would mean that retrieved data records are first sorted by the field with the sort order 1 and then sorted by the field with a sort order of 2. This is called a nested sort. You may specify up to two levels of nesting by setting this button to the values 1 and 2 on two different query lines. If the choice for this button were blank, there would be no sort order for the associated field and the records would be displayed just as they are found in the database. We'll show you how to add query lines later. Note: There must always be one query line with a value of 1 for this button. For example, say this second query line corresponds to the field 'name' of our hypothetical "contacts" document. The records would now be sorted first by the city and then by the name field for each city. That means you would see all the records for Boston with names ordered from A to Z, then those for Dallas, then those for Denver, etc. Sort Direction Multiple Choice Button Generally, sorted records are retrieved in an ascending order. That means that alphabetic information is ordered from A - Z, numeric information is ordered from 0 - 9, and dates are ordered from earliest to latest. Ascending order is indicated by an up arrow on the sort direction multiple choice button. Surefire User's Guide Page 114 You may, however, choose to display your data records in descending order. To do this, set the value of this button to a down arrow by pressing (Spacebar) when the cursor is on the up arrow. You may also press (ALT+Z) to zoom a pop-list with two choices as shown below. A descending sort would sort as Z - A, 9 - 0, latest to earliest, etc., depending on the field type. If you were to display all contact records, by city, in descending order, you would first see records for Portland, then New York, Los Angeles, ... and lastly for Boston. Field Name and Type The next two items of the query line are the ID or name of the field and the field's type. This is information only and cannot be changed. These items provide a way to read your query more easily. They are especially useful if you have conditions based on fields that are not visible on the screen. Condition Multiple Choice Button This multiple choice button indicates more specifically the way a data record will be tested against a value. The values of this button depend on the type of field associated with the query line. Also, depending on the field type, you can cycle through single and range conditions. Single conditions accept one value while range conditions accept two values. Single Conditions When the condition multiple choice button is set to accept a single value, one data entry field is provided just to the right of the button. This field is the same type as the field associated with the query line. For example, if the condition is for a date, this would be a date field. If this is a numeric condition, this field accepts a numeric value, and so on. As with all multiple choice buttons in windows, you can press (Spacebar) to see each possible value or press (ALT + Z) to see a pop-list of all values. With single condition query lines you can limit the search of your data in many ways according to a specific value that you enter. The tables here and on the next page list the single conditions for all data types: text field conditions numeric field conditions Is Exactly Equal to Begins With GT (greater than) Contains GT or Eq (greater than or equal to) All LT (less than) Is Not LT or Eq (less than or equal to) Does Not Begin With All Does Not Contain Not Equal to Surefire User's Guide Page 115 date field conditions logical field conditions On After On or After Before On or Before Only Y All Only N Not On All The 'All' Condition Text, numeric and date fields may have the special condition 'All'. The 'All' condition does not have an associated data entry field. It indicates, however, that it doesn't matter what the value of the field is in the data record. You choose 'All' when you want to display data records that are sorted on a field but have no particular value for this field. For example, you may want to view all of your contact records sorted by date of the last letter that you sent. If you had 'All' and an ascending sort on the date sent, Surefire would first display the person who you've been out of contact with the longest. Alternatively, if you had 'All' and a descending sort on the date sent, you would first see the person to whom you most recently sent a letter. 'All' is used in a similar fashion with both text and numeric fields. Range Conditions Range conditions are available for numeric and date fields. They indicate that the records you are interested in have values that fall into some range. There are two data entry fields associated with a range condition that allow you to give the top and bottom of the range. For example you may want to find all of your clients between the ages of 35 and 50. Or, you may want to send a follow-up letter to everyone with whom you spoke between May and July. As with single conditions, these fields are the same data type as the associated field of your document. Range conditions for numeric and date fields are listed below: Numeric Field Range Conditions Both GT condition1 and LT condition2 Both GT or Eq condition1 and LT or Eq condition2 Both GT or Eq condition1 and LT condition2 Both GT condition1 and LT or Eq condition2 Date Field Range Conditions Both After date1 and Before date2 Both On or After date1 and On or Before date2 Both On or After date1 and Before date2 Both After date1 and On or Before date2 Surefire User's Guide Page 116 Adding a Query Line When you first display the Query window, it contains a single query line corresponding to the document field on which you selected "Build Query". The initial condition echoes the value that was in the field at the time. The condition multiple choice is set to indicate equivalence, that is, "Is Exactly", "Equal to", or "On" depending on the type of the field. The sort order is 1 and the sort direction is ascending as indicated by the up arrow. You may change these button values prior to doing a search. Once the Query window is open, you may add other conditions. The more query lines there are, the more restrictive the search will be and the fewer records that will be displayed. You add query lines by temporarily moving the cursor back to the document and selecting additional fields for the conditions. Once there are query lines for these fields, the various multiple choice buttons and values in the Query window may be changed as desired. The procedure for adding query lines is similar to that for adding cell references to the edit area of the Command Edit window. After the Query window is open, you move to the document by pressing (Shift + Tab) and then move around using the usual keys for movement by fields, (End) and (Home). You move to any text, numeric, date or logical field. Then, press (Ctrl + Enter) to make a new query line for that field. You may select other fields this way, or return directly to the Query window by pressing (Shift+Tab) again. You move around the Query window with multiple query lines by using the (End), (Home) and the (up and down arrows). You will notice that as you move from one query line to another, the corresponding document field will be highlighted. If needed, Surefire will automatically scroll the document so that you can see this field. Note: You may define up to 20 query lines (i.e. conditions) for a query. AND'ed Conditions For every different field selected, the conditions will be AND'ed to each other. That is, the data records will be retrieved if they match all of the conditions in the query. For example, you may want to display all clients who are in Dallas AND whose name begins with "Gr". OR'ed Conditions If you create two query lines for the same field, the resulting conditions will be OR'ed together. That means that a record must match either the value in the first such query line OR the value in another query line for that field. Say you want to change your query to get all persons who either live in Dallas OR Los Angeles and whose name begins with 'Gr'. Surefire User's Guide Page 117 Deleting a Query Line By continuing to add conditions, a query can become quite complex and restrictive. At some point, you may decide that a condition is no longer needed. To remove a condition, simply place the cursor anywhere on that query line and press (Ctrl+D). You may delete any query line with the following exception: You may not delete a query line with the sort order 1 if there are no OR'ed conditions for that query line and there is no query line with a sort order of 2. If you delete a query line with sort order 1, and there is an OR'ed query line for the same field, that OR'ed query line will become the primary key. If there is no OR'ed query line but there is a query line with a sort order of 2, that query line will be the primary key. Closing the Query Window When you have added all the conditions that you want in the Query window, you can close it by pressing (Esc). This gives back the full screen to the document but will not erase the contents of the Query window. You will still know that there is a query defined by the 'Q' or 'S' in the status line to the left of the document name. An 'S' will replace the 'Q' when the current record set was obtained using the currently specified query. When you start a search, the query defined in the Query window will be used even if the Query window is not visible. Once you have defined a query in the Query window and you have not cleared it, choosing "Build Query... " from the Data menu will display the Query window with the most recently defined conditions. Clearing the Current Query To start a totally new query, you must first clear the current query. You do this by selecting "Clear Query " from the Data menu or pressing (ALT+K). You have already done this a few times in your practices. The 'Q' (or 'S' if a search is in progress) will disappear from the status line. The next time you open the Query window, the window will contain a single query line which corresponds to the current field of the document. This will be just like the first time you opened the Query window. Setting Search Options Surefire uses some default parameter settings that limit how a search is done and how data is displayed in the document. To change these settings, select "Set Search Options..." from the Data menu. A window will appear that allows you to change these parameters as described below. Any changes that you make will effect subsequent searches. Surefire User's Guide Page 118 Setting the Record Type Normally only active (i.e. not deleted) qualifying records are retrieved during a search. If you want the search to include deleted records also, or to be limited to only deleted records, you must change the multiple choice button to the right of the text "Record Type for Search". This button can have the values: "Active", "Deleted", and " All". Select the option that you desire, then choose OK. The next time you search the database, the new setting will be effective. If you had chosen "Deleted" or "All", you may see a 'D' at the far right of the status line as you display each record with (F8). This indicates that the currently displayed record was deleted at some prior time. You may later recall a deleted record. Recalling deleted records is discussed in "Chapter 21: Advanced Database Topics". The "Do Report Formatting?" option is fully described in "Chapter 22: Generating Reports". Named Queries After taking pains to construct a complex query that has many conditions, you may want to save those conditions to use again at another time. These could be queries that are run often such as: 1. Show me all my accounts that are past due. 2. Find the top earning salesman of the month. 3. Show all contacts sorted by zip code. Once a query has been built in the Query window, you may save it for later use. This named query will always be associated with the current document until you decide to delete it. Once saved, you can edit, copy, run or delete the query. To do any of these operations, select "Edit Queries..." from the Data menu. You will see the Edit Query window. This window contains one multiple choice button and one data entry field. You may view the possible values for this button by pressing (ALT+Z) to zoom the button choices. Saving a Query A named query which will be associated with a document must first be given its name. Just as with a new document, you give the query a name when you choose to save it. To save a query, set the button value to "Save Current Query" and enter a name in the data entry field. You can use a name of up to 10 characters to help you remember what the query does. For example, PASTDUACCT, TOPSELLER and MAINCONTAC might work for the sample conditions above. You then choose OK. The save will not affect the Query window. Since Surefire remembers the query information until you delete the query, you can access this query whenever needed. If you want to see the names of queries already defined for the current document, press the Zoom key (ALT + Z) when the cursor is in the data entry field. Surefire User's Guide Page 119 Note: During save, be careful not to choose a name from the pop-list, since Surefire will now overwrite the query that was associated with that name. Getting a Query Once you save a query, you may bring it back to review it, copy it, or to change it. First, you need to get the query. You can get any query that was previously saved for the current document. If the Query window is visible, this named query will replace the window contents with its saved conditions. If the Query window is not visible, it will be displayed with the query lines of the named query that you just got. When the named query is displayed in the Query window, you can make changes to it. These changes will not become part of the named query unless you re-save the query. When you do a search, the conditions of the named query, along with your changes, will be used to restrict the search. The name of the query is displayed at the top of the window. Note: Any unnamed query that was in the Query window before you did a Get Query, will be lost. Sometimes you may want to have a second query that is very similar to one you already have saved. You can quickly create this second query. First get the similar query. Now, make your desired changes and use the "Save Current Query" option to provide a different name. Running a Query If you want to use a named query to limit your data search, without opening or changing the contents of the Query window, you may run the query. To do this choose the Run Query option from the Edit Query window. Then, enter the name in the data entry field or use the pop-list to choose a name and choose OK. A search will be started immediately based on the conditions of the named query. Delete a Query Because there are a limited number of named queries per document, you may at some point want to delete queries that you no longer need. To do this, choose the Delete Query option from the Edit Query window. Then, type or choose the name of the query that you want deleted and choose OK. Surefire will ask you if you really want to go ahead with the delete operation. If you decide to proceed, that query will no longer be available. Surefire User's Guide Page 120 Chapter 19 - Sharing Data Among Documents Once you start using a database, you may find it useful to access the same data in another way through a different document. Suppose you need to send a thank-you letter to many of the clients in your contacts database. The letter would have fields for name, address, city, state and salutation. Wouldn't it be nice to share the same data that you already have in your contacts database instead of having to type this information all over again for each letter? Or suppose you simply wanted to list your contacts and their phone numbers, like in a phone book. Wouldn't it be nice to again use the same data from the contacts database? In Surefire, you can construct Smart documents for the thank-you letter and phone book to project information from the contacts document. This means you can access data from the contacts document, with a totally different context, from a completely separate document. The fields from these new documents would be linked to some of the fields of the contacts document. This linkage is achieved by projecting fields from one document to another. With projection, you can link any two documents together as long as one of the documents defines a database. The result is that the second document has a different view of the database than the original one. The notion of projection is the key to sharing data among Surefire documents. It will allow you to perform mail-merge operations and generate succinct reports from a database. In this chapter you will learn how to project fields from one document to another and thus enable this sharing to take place. Base Documents vs Projected Documents A document that defines a database is called a base document. Our "contacts" document is a base document. A document that projects information from a base document is called a projected document. The thank-you letter and contact list are examples of projected documents. You can use a projected document when you want to see only a portion of a data record whose fields are defined in a base document or when you want to see all the information in a different way. You can look at the exact same data records in your thank-you letter as you do in "contacts". In fact, you can do all the same searching operations through the letter as you would in "contacts". As you can see, projection is a very powerful and convenient idea. Projected documents are often used to support Mail Merge applications (see "Chapter 20: Forms and Form Letters") and to produce formatted reports (see "Chapter 22: Report Generation"). Surefire User's Guide Page 121 Projected Fields Earlier in this manual we introduced the concept of a field's data attribute. In the simplest sense the data attribute determines whether a field is stored in a database or not. When you first created fields in the property lease, this attribute was set to Not Stored. Later you changed some of these fields to be Stored so that you could add a record and create a database. Well, a projected field is also stored, however its value is stored in a different document from the document that contains the field. When a field is projected it has the data attribute "Projected". Let's now take a closer look at the letter document. While most of the fields are projected from the contacts document, the date field is not. In fact, this date is set to default to today's date. Documents that contain projected fields may also have other fields that are not projected. It is often very useful to have fields that contain the result of an operation based on the projected fields. Multiplying current sales figures by a growth rate to forecast next year's sales is only one example. Note: Any number of documents may share data from one base document. However, a document can not have both stored fields and projected fields at the same time. That means that once a document has one field that is Projected, it may have no fields that are Stored. Conversely, once a document has a Stored field, it may have no fields that are Projected. Surefire will warn you with a message window if you try to make an invalid projection. Now let's move on and explore two ways in which you can project fields. You will be surprised how easy it is to do. Projecting Fields Using the Clipboard You can easily project a field interactively by following a procedure that is very similar to the combined operations of Copy and Paste. First you edit the document that defines the fields you want projected. Then you use Block or Line Selection to select the portion of your document that contains the fields you want projected. Now, instead of choosing Copy or Cut, you choose "Project" from the Data menu. The fields and surrounding text are copied to the Clipboard. You then Get the destination document (or create a new document) and Paste the clipboard object. That's all there is to it. Even without saving the document, you can immediately use it and access the database! As with copying fields between documents, the only information that comes along with projected fields are the fields' types and format attributes. Commands in the original fields will not be preserved in the projected fields. Surefire will automatically assign new field IDs. If you want to give these fields appropriate user names, you may do so via the Command Edit window (see "Chapter 15: Using Field Commands"). Now let's look at another way to specify projected fields. Surefire User's Guide Page 122 Projection as a Field Attribute You have seen that a field can be either stored in a database or projected from a database defined by some other document. A field's data attribute determines whether a field is stored in some database or not at all. You can use the Field Create and Field Modify windows to set the value of a field's data attribute. There may be times when you want to project fields by setting the field's data attribute directly. If you set the value of the data attribute multiple choice button to Projected in either of the above windows, you will see two additional fields. These fields allow you to enter the name of another document and the name of some field in that document. Once you enter the name of a base document in the "Document:" field, you can move to the "Field:" field and press (ALT+Z) to see a pop-list of valid fields. If the field is already projected, the window will indicate the correct base document and field. Note: If you project a field using this approach, and the projected field is smaller than the original field, your data may be truncated when viewed through the projected document. On the other hand, if the new field is larger, the excess space is appropriately padded. Any truncation that occurs will not affect the actual data stored in the database. Using Projected Fields vs Original Fields You may resize projected fields at any time. When they are made smaller, truncation will occur when you view the data. When they are enlarged, they will be padded appropriately. It is important to note, however, that adding data to a database through a projected field which is bigger than the corresponding field in the base document will result in the database truncating the value to the size of the field in the base document. While you may add records to a database using projected documents, these records will generally be missing some information. Say you added contact information to the contacts database using the letter. Because the letter only has fields for name, address and salutation, the other information such as phone number and age will be missing for this contact. You can fill it in at a later time by updating the appropriate database record using the contacts document itself. Searching in a Projected Document Generally, you build queries using projected documents following the same steps that you use for base documents. However, there are two important differences that you need to be aware of: 1. If you build your query from fields that are projected from another document, the field name or ID that will appear on a query line is the name or ID of the field in the base document. Surefire User's Guide Page 123 2. Very often, your projected document will not have all the fields that exist in the base document. However, you may want to do your query based on some of the fields that are not in the current document. For example, suppose you have a letter with projected fields for name, address and salutation. You now would like to send this letter to all contacts over the age of 30. But age does not appear in the letter, so how do you target your clients with this condition? To do this, you open the Query window by choosing a projected field to give the initial query line. Then, you press (Ctrl+Z). This will display a pop-list of all database fields in the base document, including those that are not projected in the current document. If you choose one of these fields, a query line will be created for that field. This field may have no corresponding field in the current document. Or, this may be a field on a different page which is not currently visible. You may now change the new query line to the condition that you want. If you make this field the primary key, you may remove the query line of the field with which you initially opened the Query window. To do this, move the cursor to the line and press (Ctrl+D). In the next chapter you will use what you have learned about projections to do the very common tasks of generating form letters and mailing labels. Printing Your Data Sometimes you will use a Surefire document to review information on your screen. Often, you may want to print some of this information. Up until now you have seen how to view only one record at a time. The following sections discuss two ways of printing your one-at-a-time data records. The first method allows you to decide very specifically which of your qualified records to print. The second method allows you to print all of your qualifying records without any intervention. In "Chapter 22: Generating Reports", you will see how to view and print information from more than one record at a time. Printing the Current Record No matter how you search for your data, you can always print the document for the currently displayed record. In fact, you can review each record and print only those that you wish. Suppose you just did a search in your contacts database for everyone who lives in New York. You can now go through these records using (F8) and (F7). As you do, you selectively print the ones that you expect to contact while you are in New York on business. Surefire User's Guide Page 124 Sometimes it may be handy to write a note about a specific contact right on the contact record. You do this by switching to Text edit mode, editing the text, and then printing that record. You can then switch back to using the document to view other records. Before you can use the document again two message windows will be displayed. Just choose YES on both of them. Printing All Qualifying Records Often, you may want to print all the records resulting from a query without reviewing each record as it is retrieved. This may occur if you are running a mail-merge operation where the result will be many letters or mailing labels, each one being composed from a different database record. To tell Surefire that you want this to occur, you must first build a query or Get a named query. You then use a special feature of the Print window to start a Search & Print operation. Surefire will qualify matching records according to the query conditions, retrieve each record into your document and print that instance of the document. Adjustments will be made for autosized fields as well. Since this feature is most often used during form letter generation, a full discussion will be deferred to the next chapter - "Forms and Form Letters". Surefire User's Guide Page 125 Chapter 20 - Forms and Form Letters Suppose you have a letter that introduces your new product and you would like to send it to all your clients in a particular region of the country. However, you want to send more personal letters to your best customers. Before the integration of word-processing and database features this was a tedious task. You had to sit at a typewriter with the index cards for these clients in hand, and to type each copy of the letter with the appropriate names and addresses each time. Then, you had to type the names and addresses again on the envelopes. Other tedious and repetitious tasks include invoices, contracts, leases, sales agreements, order forms and reports that are done periodically. This includes all the standard pre-printed forms, which require you to "fill in the blanks", that you can buy at your local stationery store. All of these everyday examples require you to enter specific information into portions of a document. Many software packages available today offer some way to merge data into your word processed documents while they are being printed. However, you need to learn new concepts that are specific to these merge operations. And most require the use of cryptic codes and special files that have to be set up just right to work. This is usually referred to as mail-merge or merge printing. In Surefire, there is no separate mechanism for specifying data files, no cryptic merge commands and no new concepts to learn. Combining text, data and calculations within a document, in a natural-to-use way, is the basic idea behind Surefire. So, setting up to generate form letters, mail labels, envelopes and pre-printed forms is no different than composing a Smart document for a specific purpose. This chapter shows the various ways Surefire can produce form letters, mail labels, envelopes and pre-printed forms by using some of the basic concepts already discussed in this User's Guide. What You Need to Know To conveniently produce forms or letters you need to create a Smart document for your specific task. After you have the right Smart document, generating the forms or letters on you printer is a simple matter. The first thing you do is to specify a query using the Query window. Then, using the Print window you select Search & Print. Surefire will retrieve each record according to your query, put it in the document, do autosizing where specified and print. You will enjoy seeing each form or letter composed on the screen and be able to stop the process if you need to. There are three flavors of Smart documents that may apply. The creation and use of these Smart documents have already been described completely in previous chapters. We will discuss them here as they relate specifically to forms and form letters. We will first look at the differences between them and for what purposes each of them is best suited. Surefire User's Guide Page 126 Documents with Fields and No Database This type of document allows you to quickly find and enter data into the specific places you need to fill in. This is done through the simple use of fields. These fields may also be used to allow your input to be only a date or a number. In addition, fields can be set to automatically size according to the text that surrounds it. You can also perform calculations automatically as you make entries. To produce multiple documents of this type you fill in the blanks and print. Then you clear the fields, fill in the blanks again and print again. Your typing is reduced to the minimum and each version comes out perfect on the printer. This method is very useful but it assumes you will never expect to re-use the information you've typed in. Once you've printed the document and cleared the fields, the paper version is the only version you have. In some cases, this may be exactly what you want. If you want to keep the data along the way, just set up your document to have stored fields. This is the second flavor below. Documents with Stored Fields A document with stored fields is a document with a database. It can be set up just like the one described above, but the data can be saved while its being entered. All you need to do is to make sure you are using stored fields. Now it becomes easy to do a lot of exciting and powerful things. You can first type in all the information at once and then print it all. You have all the data already entered, so later you can change the form or letter and print the whole set again. Or, you can print only a portion of the set. Not only that, unlike other systems that do merge printing, you only need to work with one document. The same document that you print from is the same document you enter data into and the same document you can change when needed. There are no separate files that have to be merged. Since your Smart document now has a database, you can access it to find a specific person's address, use it for reference and even extend the information you are collecting. You now have all the power of a database. And, you can interact with your data directly through the form letter or form you've created. Surefire User's Guide Page 127 Documents with Projected Fields A document with projected fields allows you to access information from the database of another document. With this, you can do two things. First, you can access data through a subset of all the fields that were defined in the original document. Secondly, it gives you a way to keep multiple letters or forms, ready to go, all accessing the same database. Product announcements, follow-up letters and order forms can all share the same database, eliminating the redundant entry and duplication of information. And don't forget, you can create buttons for immediate access to your documents to build your own integrated application. Projected documents are very easy to create. The easiest way is to use the Clipboard to copy the portions of your original document along with the appropriate fields. Paste the copied portion to a new document, edit the new document to be the way you want, save it, then start using it. When you've done this once, you will realize there can be no easier way. Now we will take you through a few practices to show you just how it is done. You will see specific examples for form letters, mailing labels and envelopes. You will also see how to set things up for a pre-printed form. Mailing Labels Mailing labels, form letters and envelopes are all very similar in that they are primarily made up of the names and addresses of people whom you contact. With one "contacts" database you can easily generate mailing labels and the other stationery from the same data. Keep in mind, however, that if all you want to do is make labels, the process is very simple. If you just have a few to do, set your page format for mailing labels and type in the text for as many labels as you need. When you're finished, just print the document. As an alternative method, just create a label document with stored fields and enter the names and addresses directly. Since this becomes a database, you can use "Search & Print" to generate the labels that you want. You can easily create mailing labels for your contacts database by doing the following: 1. Edit your contacts document. 2. Project the fields. Use Block Select from the Edit menu to select the name, company and address fields. Choose Project from the Data menu. Press (F6) to hide the clipboard object. Now Block select the city, state and zipcode fields. This time take some of the text with it. You will be able to delete it later. Choose Project again from the Data menu. Press (F6) to hide the second clipboard object. 3. Choose New from the File menu to clear the document for a new mailing label document. Surefire User's Guide Page 128 4. Paste the projected clipboard objects. View both clipboard objects by pressing (Shift + F6). Use the (Shift + Tab) key to select the first clipboard object. Move the object with the name, company and address to the upper left corner of the page and paste it by pressing (ALT+F3). Paste the remaining object below it. Now remove any unwanted text such as "state:", "zip", etc, by using the (Delete) key. Type in a comma ',' between the city and the state. 5. Change the format for mailing labels. Choose "Format..." from the Page menu to open the Format window. Press (ALT+Z) to zoom the page sizes and choose "mailing labels". Make sure the margins are all set to zero. Choose OK to set this new format. The page size is actually a bit wider than 3 1/2 inches to accommodate the autosizing of certain fields. Notice that the bottom and right parts of the screen are shown with the same shading as a page break. This is because a mailing label is a very small page; not even as big as the screen. 6. Save the document with a name such as "labels". Printing Mailing Labels You will now see how to print mailing labels for all of your contacts ordered alphabetically by state. Before you start printing, make sure that you have loaded your printer with the appropriate stock for the type of document you are printing. For mailing labels, use the single column 3-1/2 by 1 inch labels. Now follow this procedure: 1. Do a trial print. Get the your "labels" document and view any record by typing (F8). Choose Print from the Print window to just print the current record. Make sure that the printed text lines up well with the label. If not, make the appropriate adjustments to your printer so that it starts printing at the upper left corner of your labels. 2. Build a query. Move the cursor to the state field before displaying the Query window. Choose "Build Query..." from the Data menu or press (ALT+Q) to display the Query window. Set the condition to find all contacts sorted alphabetically by state and press (Esc) to close the window. Query window. 3. Start the Search & Print. Press (ALT+F) P to display the Print window. Choose SEARCH & PRINT. Each copy of the mailing label will be briefly displayed on your screen before it is printed. Surefire User's Guide Page 129 Envelopes Envelopes are very similar to mailing labels. You can project the fields in exactly the same manner. The only difference is that you format the document to have an envelope page. Do this with the Format window. If the size you are using is in the "Page Sizes" pop-list, just select it. If it isn't, you can specify the size explicitly by choosing "Specific Setting". This allows you to type in the width and length of your envelope. After setting the page size to match that of your envelope, paste the projected fields so that they are lined up on the page as you would like to see them on the envelope. If you already have a mailing label document, you may create an envelope document even more easily. Just Get the label document and re-format the document with a page size of the proper envelope. Then, move the fields to their appropriate places and Save the document with a different name. The fields are automatically projected from the same database. If you wish, you may type in your return address in the upper left corner. The return address will then also be printed on each envelope. Now save your document. Use (F8) to get any record. Print just one envelope to see how things line up. Make adjustments if needed. Form Letters Form letters are similar to mailing labels and envelopes except that the address information is put on an 8 1/2 by 11 inch page with margins. There is also a lot more text. And, of course, letters can have more than one page in the document. Use the same procedures already described for mailing labels to project fields. You may first type the text of your letter and then bring in the fields or you can start by projecting your fields. Date fields are a very handy feature in form letters. You can create a date field to always hold today's date. To do this, create the date field, where you want it, using the Create Field window. Make sure the "Default to Today" attribute is set. Now, whenever you use the document, today's date will automatically be set in the field. Form letters may also have fields embedded directly within the text of your paragraphs. Suppose you are keeping the age of your clients in your contacts database. Suppose further that you sell insurance and you want to inform clients who are over the age of 65 that a special policy is available. You would like your letter to read something like: "Being ?? years old entitles you to a very special policy..." The "??" can be substituted with the correct age just as easily as the address information. Just project the age field, but first make sure you select it with "Line Select" from the Edit menu. Now you may insert it, just like a word into your letter. By the way, don't forget that this field will behave just like a word. It will wrap and move as you edit the document. You can access the database with the document. Surefire User's Guide Page 130 Now you can print your letters based on age and have the age appear where it should in the sentence. Just open the Query window when the cursor is on the age field. Make sure the condition is set to search for contacts over age 65. (i.e. age GT 65 ). Finally, choose Search & Print from the Print window. Pre-Printed Forms In Surefire, you can make your own forms. You can set up an invoice or sales quote form the way you want, for example. You type in the text, draw the desired boxes and lines and create or project needed fields. Sometimes, it is more desirable or convenient to use pre-printed forms. These forms already have all the "standard" text and lines printed on them. Your job is to fill it out. As you might expect, you can set up documents in Surefire to print on these forms too. There are two things to consider when setting up for pre-printed forms. One is that the fields need to be accurately positioned so they will line up properly when printed. The other is that the Smart document containing these fields should not have any other text in it. For pre-printed forms, it is best to use two Smart documents. One will have all the needed fields lined up conveniently to be used as an outline on the screen. Informative text will show what type of data is expected in each field. These fields will be stored in a database. The other form document will have a page size that is exactly that of the paper form. You would project the fields from your outline document and position them exactly where they need to be for printing. Use the form document to do the printing on the paper form and use the outline document for data entry. You can position the fields on the form by knowing your font size and making some simple measurements. Since there are always 6 lines per inch, you can measure the height of the form in inches and multiply by 6. This will give you the number of lines on the form. By finding where the first blank area is, you will have the line on which to start your field. Now determine the pitch for your font. Look at the "Print Font" multiple choice button of the Format window to see how many characters per inch your font will print. Get the distance from the left edge of the form to where there is a blank space for typing. Multiply this distance by the characters per inch (pitch) of your font. This will give you the column at which to place a field. Do this for each space on the form and take note of the column numbers. Now you have enough information to place your fields correctly. After the fields are lined up in your form document, fill them out completely. Fill text fields with x's, numeric fields with 1's, etc. Then do a trial printing on a real form. Adjust your fields as needed. If all the fields are off by the same distance, you may just need to move the whole group of fields over a bit on the page. If not, you may need to move some of the fields individually or you may need to adjust the form in the printer to start at a place where things are lined up. Surefire User's Guide Page 131 Chapter 21 - Advanced Database Topics In this chapter you will learn about the more advanced features of Surefire databases. These features will allow you to be more efficient as your databases get larger. Changing the Database Structure In Surefire, you define and create a database by indicating that certain document fields are to be stored and by then adding your first record. You may still add, remove and change the sizes of these fields in any way you wish. However, altering fields may require a new database structure. Sometimes this new structure will affect the data already stored in your database. Creating this new structure is called restructuring. Let's illustrate with an example. Suppose the name field for our "contacts" document can only hold 15 characters. Up till now this has been sufficient, but you just met a woman named Sharon Swenson-Tannenbaum and you realize that the name field needs to be bigger. Don't worry. You can change the size of your field and let Surefire take care of the rest. First, you need to edit your document to enlarge this field. (See Chapter 14: Working With Fields). You do this in the same way as if the field were not stored. But this time, when you try to use your document again, Surefire displays a message window saying that a database restructure operation is necessary. A database restructure is an automatic operation that changes the database definition and adjusts all existing records to account for the field changes. Surefire will recommend a database restructure whenever you add, delete, resize or change the name of one or more stored fields. You may remember that the records that you delete are actually just marked as inactive. This gives you a chance to reconsider whether you actually want them permanently removed from the database. After a while, it may become inefficient to search a database with many extra records. You may remove these records from the database permanently through a restructure operation. Choosing "Restructure" when you have not changed any stored fields, will simply remove these unwanted records. A change in a Stored field's name requires a change to the database definition and thus a restructure. If you want to change the name of a Stored field, you must do so while editing the document. Just switch to Document edit mode and then open the Command Edit window to change the field names. You may change all field names as desired before choosing the restructure operation. You tell Surefire to begin restructuring the database by choosing "Restructure" from the Data menu while in Document edit mode. Surefire User's Guide Page 132 Surefire will preserve your existing data wherever possible. However, sometimes a restructure may cause data loss or affect other documents. So, before beginning the restructure operation, Surefire will give you a chance to reconsider in any of the following cases: If you Continuing may Make a stored field smaller. Cause truncation or loss of data. Delete a stored field Cause data loss. Delete or shrink a stored field Affect projected documents. In when other documents project data addition to the above from this document. consequences, you may have projected documents with fields projected from fields that no longer exist. You must remove these fields. Note: When you change a stored field, Surefire does not perform a restructure automatically. This is because you may be modifying several fields during the same period, and it may take some time. The restructuring will take more or less time depending on the current size of the database. Note: You will not be able to use the document again until you either restructure your database or exit from Surefire without saving your changes. Using Calculated Fields A calculated field is a field whose value depends on one or more other fields in the document. The value of this field is set when a field command is executed. Each time you display records from the database, all field commands are re-executed. This allows the fields whose values are based on stored fields to be calculated correctly for the current record. Usually, you would not store these fields in a database since Surefire can calculate their values as needed. In the "lease" document that we use in practices, there are some calculated fields whose values are based on stored fields. Two of these are the lease deposit and balance. They are both calculated to be half the lease amount. Only the lease amount is stored. Each time that you display a record of the lease, the deposit and balance change to show the correct amount for that particular lease. Sometimes you may have a document that does a lot of calculations and you notice that it takes a long time to display each record. Now, Surefire could display your data more quickly if you stored your calculated fields. This is because the commands used to generate the values would not be re-executed for each displayed record. Surefire User's Guide Page 133 There is another reason why you may want to store a calculated field; you can search on the value of a calculated field only if it is stored. For example, if you wanted to look for all the tenants who paid a deposit of more than 400 dollars you would need to store the deposit field in the database. If you find yourself wanting to query the database about a calculated field, you can change the field's data attribute to Stored, restructure the document and you have it. Using Hidden Fields You can use a hidden field to store temporary results from calculations or to support a look-up table. A hidden field can also be used when you want to calculate and display a value based on a database field, yet you don't want to see the database field itself. Hidden fields are not really hidden at all. They just reside at a place in your document that is not normally displayed or printed. Suppose your database has a field containing a "method of payment" code. These are two letter codes corresponding to how an order will be paid: Code Meaning CK Check MC Master Card VS VISA AM American Express CS Cash Now, you would like the full text description to be displayed. Here's how. For each possible code, you put the appropriate text string in a hidden field on another page of your document. When a data record is displayed, a field command is executed that tests the particular database field containing the code and finds the appropriate text in the look-up table. Here's another example of using hidden fields. Suppose you have a projected document where you want to display data calculated from certain database fields but you do not want the original fields to appear. Since all field references in the calculated field must be known (i.e. exist somewhere in the document), you will need to use hidden fields. It is generally convenient to put hidden fields on the last page of the document, separate from everything else. You can label them and make notes next to them as you wish. And, when you print, if you do not want this page printed, it is easy to say so in the Print window. Surefire User's Guide Page 134 Using Database Searching Functions There are a number of functions in Surefire that specifically relate to database operations. Some functions allow statistical calculations on field values that span more than one database record. These include finding the sum, average, maximum and minimum values for a set of records. These functions are only meaningful when you display a list of records as a report. They are therefore discussed in "Chapter 22: Generating Reports". Other functions used with data records control searching a database. These are typically used in field commands for button fields. These functions are used extensively for building applications with Surefire's Smart documents. The table below summarizes these functions. Use Function To @QUERY Run a named query. @JOIN Run a named query in another document. @CNDX Define conditions to be used in @QUERY or @JOIN. @UPDATE Update the currently displayed record with all field values. @SEARCH Search the database based on the value in the current field. On the following pages we show how to use the @JOIN and @CNDX functions to join a base document with a document projected from the same database. At the end of this chapter, you will learn how these functions may be used to join two databases together. These functions are fully described in the section "Database Searching Functions" of "Appendix A: Surefire Function Reference". The use of @CNDX and @JOIN together is especially powerful. Because of this we will explain through an illustration and a step by step how they work. The documents "contacts" and "letters" are linked together through the use of these commands. This command is in the Letter button of "contacts": @CNDX("letter", "curname", A, ,"name"); @JOIN("letter", "curname") In the "letter" document is the query "curname" with a query line looking for "the Text field 'name' Is Exactly blank". The blank data entry field for the condition will eventually be filled in by the result of the @CNDX function or what is in field A, the contact's actual name. Let's discuss how everything works together. When you press the button Letter, you will see a letter with address information for the current contact. To do this, the button has a command with both an @CNDX function and an @JOIN function. The @CNDX function sets a value for a specific condition of a named query. (You can use one @CNDX function for each condition or query line of a query). The @JOIN function tells Surefire to display the specified document and search the database using a named query. Surefire User's Guide Page 135 It's not always necessary to set values for conditions of a query, but we want to in this case. That's because we want to display the letter showing only the address information for the currently displayed contact. The @CNDX here has these arguments: ("letter", "curname", A, , "name"). The first two arguments tell Surefire to set a value for a condition in the named query curname in the document letter. Notice the quote marks ("); they are required. The third argument, A, represents field A in the "contacts" document. This field holds the contact's name. Because this field was given the name "name", we could have used name instead of A in the function. When the command is executed, Surefire will remember the value of the contact name field. It will then use this value for one of the conditions of the named query 'curname'. The fourth argument is missing from this function as shown by the two commas. This argument would be used if we were setting the values of a range condition. It can have the value for the upper end of the range. In our example we have the single condition Is Exactly, so this argument is not needed. The fifth argument tells Surefire the specific line of the query whose condition you want to set. In this case, "name" relates to name which is displayed at the left of the query line in curname. The quotes (") here are also required. Notice in the query that we left the data entry field to the right of the condition button blank. This is because we want Surefire to substitute a value from the @CNDX function before the query is actually used. If the query curname were executed without setting a condition value, the search would look for contact names that are exactly all blank and would probably find no matching records. Finally, the @JOIN command says simply to display the document letter and run the query curname. So now Surefire knows that you really want to display the letter for the contact whose name is in the name field. The practice on the next page gives you the steps to display the letter for the currently displayed contact at the press of a button. Recalling a Deleted Record The data records that you delete when you choose "Delete Record(s)" from the Data menu are actually not removed from the database but are made inactive. You may recall a previously deleted record, that is, restore it to an active status, if it is the currently displayed record. But, since deleted records are not usually displayed, you must first indicate that you wish to view these deleted records. You do this by changing the setting of the "Record Type for Search" button in the Search Options window to All or Deleted. This window is accessed from the Data menu and is described in the chapter "Searching a Database". Then, you can define a query and start your search. The records that interest you will be displayed. Surefire User's Guide Page 136 When the record you want to recall is visible, choose "Recall Record(s) " from the Data menu or press (F5). The status indicator "RECORD RECALLED" will be briefly displayed at the right side of the status line. Note: All inactive records are finally removed from the database when the database is restructured. Until then, you may recall them whenever you wish. Manipulating Record Sets Up until now we have been talking about how to work on one data record at a time. Suppose you had a number of salespersons who were responsible for different territories. The salesperson and territory might be fields of your contacts database. If you want to reassign all of the clients in one specific territory to another salesperson, you certainly wouldn't want to change and update each individual record in that territory. Surefire provides a way to update, delete and recall all records in a record set. That means you can update, delete and recall all the records that satisfy specific conditions at one time. Updating A Record Set Sometimes you may want to have the value of a single field updated to reflect some new information for all records that satisfy certain conditions. This is often called group update or mass update. For example, you might have just sent a letter to all of your contacts in a certain zip code. You will want to change the date of the last letter sent, in all of these records, to today. To do this, you must first build your query or Get a named query. Then, instead of performing a search, you move to the document field that you want changed and enter the new value that you want all the qualifying records to have. Choose "Update Record(s)" on the Data menu. Before the update takes place, the message "All qualifying records will be updated" is displayed. Choose YES if you want the update to occur or NO otherwise. After all records have been updated, the status indicator "RECORD(S) UPDATED" will be displayed briefly at the right of the status line. When the update is finished, all records will have the new value. You can repeatedly use the same procedure to update other fields of the same qualifying records. Deleting A Record Set When you delete a record, you display it first to make sure that it is the correct one. At times, you may want to delete a group of records that satisfy some specific condition at one time without reviewing each one. This is sometimes called group delete or mass delete. For example, you may want to remove all contacts where the last correspondence was sent more than two years ago. Or if you've just stopped eating red meat, you may want to remove your recipes that include beef. Surefire User's Guide Page 137 To delete these records, you can follow a procedure similar to that used for a group update. In this case, you build or Get a query but you do not specify a new field value. Then you choose "Delete Record(s)" from the Data menu or press (ALT+F5). Before the deletions are done, the message, "All qualifying records will be deleted", is displayed. Choose YES if you want the deletes to occur or NO otherwise. After all records have been deleted, the status indicator "RECORD(S) DELETED" will be displayed briefly at the right of the status line. If you continue after the warning message, all qualifying records will be deleted or made inactive. You may, of course, recover them by restoring them to active status through a recall operation. You may practice this using a query of your choice and then recall the deleted records by following the procedure in the next section. Note: You must change the "Record Type for Search" option in the Search Options window to All or Active before deleting a record set. Recalling A Record Set Especially if you have second thoughts about records that you deleted as a group, you may sometimes want to recall a group of records at one time without reviewing each one. To do so, you follow a procedure which is similar to deleting a record set. The only difference is that you choose "Recall Records" from the Data menu or press (F5), instead. All qualifying records will be recalled. Before the recall takes place, a warning message is displayed. Choose YES if you want the recall to occur or NO otherwise. After all the records have been recalled, the status indicator "RECORD(S) RECALLED" will be displayed briefly at the right of the status line. Note: You must change the "Record Type for Search" option in the Search Options window to All or Deleted before recalling a record set. Importing and Exporting Data You have seen how to use the database features of Surefire's Smart Documents to keep your information in one handy place. Sometimes, however, you may need to use data from other database systems. Or, you may purchase data such as mailing lists in a format that you would like Surefire to read. In the following sections you will learn how to use the import and export facilities of Surefire to bring in data from other programs and output data from Surefire to other programs. You will see that by exporting and importing data, you can easily create new Surefire databases and even merge many databases into one larger database. Surefire User's Guide Page 138 Importing Data If you have data from another program that you wish to incorporate into a Surefire database, it must be in the form of an ASCII data file. You need to follow the procedures for the application from which you are getting the data. Most popular applications will be able to output data to a file in this ASCII (text) data format. Once you have the data from the other program in the correct format, you can import that data into Surefire through a document. If there is already a database associated with the document, the imported records will be appended to the database. If there is no associated database, one will be created. To import the data you use the Get File window by setting the file type button to "Data File". There are some simple formatting rules that must be followed to be sure that both the ASCII data file and your document conform correctly. These rules are described below: Format for the ASCII Data File 1) Each text value in the ASCII file must be surrounded by quotes ("). Number values may or may not have quotes. 2) All values must be delimited by a comma (,). 3) Each record or set of data values must be terminated by a (CR-LF) character. 4) If no filename extension is given to the ASCII file, the default extension, .DTA, will be assumed. Rules for Setting Up Surefire Documents for Import 1) If there are n fields to be imported into the database, the first n Stored or Projected fields of the document must correspond in order and type to the fields in the ASCII import file. The ordering of the fields in the document is the same as the way you move from field to field using the (End) key. That is, from left to right and then down through the document. Corresponding in type means that number values in the ASCII file go with numeric fields in the document, text values go with text fields, etc. 2) Any additional Stored/Projected fields in the document will set their associated database fields, in all records, to their currently displayed values in the document. If there are calculated fields which are Stored, the calculated values for these fields will be stored in the data records. That is, the calculations will be performed just before the imported data is added as a record. Database fields without corresponding document fields will have their values cleared in all imported records. Surefire User's Guide Page 139 3) There must be at least as many Stored or Projected fields in the destination Surefire document as the number of values you want imported from each record in the ASCII data file. 4) The ASCII data file may have field values that you do not want to import. If this is the case, you must create a Non-Stored field of the appropriate type in the proper place in your document. This dummy field will act as a placeholder to accept the value. Use a dummy field also if there are empty values at the same place in all records of the ASCII file. Empty values are indicated by two adjacent commas (,,). 5) If a Surefire document field is smaller than the value for that field from any imported record, that value will be truncated. Say you want to import data from a file that we have set up as an ASCII data file from another database. This database has the following fields defined; person's name, age, phone number and marital status. The first field is a text string, the second is a number and the third and fourth are also text strings. To import the data from this database into a Surefire document, you need to get the data written like this: "name",age,"phone number", "marital status" (CR-LF) or "name","age","phone number","marital status" (CR-LF) Notice that the age field may or may not have double quotes ("). This is because it is a simple integer number. Notice also that each line in the example text file is terminated by a carriage return and linefeed character shown here as (CR-LF). Now let's say that you want to import this data (which is in a file called IMPORT.DTA) into the "contacts" document. This document contains fields for name, address, phone, age, notes, etc. You may notice that the order of the fields in this document doesn't match the order of values in the data file. Also, there is no field in "contacts" corresponding to marital status. What you need to do is create a projected document with projected fields for name, age and phone number in this order. This document will have a dummy field for marital status. Note: You could add a marital status field to your "contacts" document and restructure your database. Then you could also project the marital status field and also import the marital status data. As you import data, each successive record read from the ASCII file will be added to the Surefire database that corresponds to the document. Any fields in the document that follow these four fields will be unchanged by the import. If there are any Stored or Projected fields in the document that do not correspond to values in the ASCII file, their values that are displayed in the document at the time of the import will be used to set default values for those fields of the new data records. If there are no such fields, the values of these parts of the data records will remain clear and can be filled in later. Surefire User's Guide Page 140 Exporting Data If you have data in a Surefire database that you wish to incorporate into another program, you may do so by writing the data out into an ASCII data file. This is known as exporting the data. In Surefire you can export data using the same format already described for importing data. This format is understood by most popular programs. You may use any query to limit which data records are exported from a database. You may use projected documents to limit which fields of data records are exported, and to rearrange the order in which their values will be written to the ASCII data file. To export the data, use the Save File window, setting the file type button to "Data File". Then follow the rules described below. Rules for Exporting Surefire Data 1) No export will occur unless the associated Surefire database exists and there is at least one record that satisfies the search conditions. An appropriate query must be specified before the data export is initiated. 2) The values of all fields of the current document, excluding buttons, will be exported. 3) The order of the fields put into the ASCII data file will be the order in which they appear in the Surefire document. 4) The output of the export operation will be in the ASCII data file format described on page 21-17. To export data from a Surefire database, follow these simple steps: 1) Get the document from which you want to export data. 2) Build a query to limit the records to be exported. 3) Open the Save File window and set the File Type multiple choice button to "Data File". Type in the name of the file you want to contain the exported data. Surefire will give this file the extension .DTA. Press OK to start the database search and export operation. You will hear a beep when the export has finished. Merging and Extracting Surefire Databases There are times when you may want to create a new database from one that already exists. This new database may have fewer records or fewer fields. With a smaller portion of the data, all your database operations will perform more efficiently. Also, you can analyze this data while someone else is using the original database. You would use this smaller database periodically, perhaps, to do your monthly reports. Each month, you would extract the most recent data from the "master" customer database. Surefire User's Guide Page 141 At other times you may want to have a database that is a conglomerate of many other databases with the same format. For example, say each salesperson has a database of sales activities that are in his territory. You may want to "merge" these independent databases into a single one for analysis. You can analyze the effectiveness of all your sales activities to help produce your sales forecasts. Since the file format required for importing data and the one needed for exporting data are the same, you may use consecutive export and import operations to extract and merge data from Surefire databases. The databases may be merged together simply by importing one or more extracted ASCII data files into the same document. Joining Two Databases Earlier in this chapter you were introduced to the database searching functions. You saw how to use @JOIN and @CNDX to join two documents together that share the same database. With Surefire it is not necessary that a database be shared for one document to link with another. The only thing that is required is that the two databases share at least one piece of data. As long as the fields with this data are the same type and size, a join is possible. For example, if your "contacts" database has a field for company name. you might have an "account history" database that also has a field for company name. Let's call the account history document, "accthist". If records are entered in both databases for the same company, a button in the "contacts" document can be used to bring up the account history information about the current company. You would use the @CNDX function to set the query condition based on the company name in the "contacts" document. You then use @JOIN to go to and execute a named query in the "accthist" document based on this same company name. Voila, you are well on your way to creating Smart Document applications! Surefire User's Guide Page 142 Chapter 22 - Generating Reports Up until now you have seen how to get one record of data into your document at a time. Often, you want to see many records or data fields in relation to one another at the same time. You may want to see just the names and phone numbers of all your contacts. Or, you may be interested in seeing statistical data based on your records. This can be something like the average salaries of personnel in each department of your company, or the number of clients in each city of a region, etc. A report is the result of using a document to retrieve more than one data record at a time. You can use a report to see many records in relation to one another or to produce a summary of database information ready for printing. You might want to list all of your contacts and their phone numbers or your company personnel and their departments. Suppose you use a document to enter information about the personnel in your company. This document might have fields for name, title, phone, mail stop and department laid out one above. Because of the difference in layout and amount of information, the document you use for a report generally has projected fields. You create this document by projecting fields the way you would for forms and form letters except you place the fields and text differently, generally left to right across the page. You then give the fields report attributes. Instead of having each data field on a separate line or imbedded in paragraphs, you generally will have the fields across the page with column names across the top of each page. Surefire's general page layout capabilities allow a report to be printed on an 8-1/2 by 11 page with standard margins and a header on each page. There is no reason why you could not use a document laid out in report format to add and review records one-at-a-time as we discussed in the previous chapters. However, you can see that the first document is more convenient for data entry. Now you will learn how to set up the second type of document layout for data reporting. Formatting a Report A field's format attributes determine the way data in the field looks. Its data attribute determines whether or not a field is stored in a database. A field may have one other type of attribute. The report attributes of a field determine how the values of many database records are to appear in your document. You assign report attributes to fields in order to tell Surefire that a document will be used to retrieve more than one data record at a time. You specify these additional attributes in the Format Report window. You may display this window by choosing "Format Report..." from the Data menu while you are in Document edit mode. This window contains various options that determine how multiple data records will expand into your document to produce a report. Surefire User's Guide Page 143 An entire document can be a report or you can imbed your report directly within the body of another document. Suppose you want the milestones that represent the progress on a specific task to be generated right into the middle of a progress report. Or suppose you have supporting statistics that you want to appear as an addendum to a summary letter. By placing the fields with report attributes at the proper places in your document, you can accomplish this. You don't even need to worry about having lots of empty pages in your document since Surefire will add pages as needed to accommodate all the records. This gives you a lot of flexibility. The following sections describe each of the formatting options available in the Format Report window. Specifying Repeated Fields You indicate how the data of each retrieved data record will be displayed one after another by giving these fields a repeat setting. Surefire still uses fields to display the values of stored data records, but just before each successive qualifying record is displayed, the repeated fields "move" to a new location. With a repeat setting, you specify where this new location is. Now Surefire can display the next set of data. To generate a report, you must have at least one field that has a repeat setting. Generally, you would set your repeated fields before using any of the other report attributes. You can repeat both stored and non-stored fields. The non-stored fields are usually fields with values calculated from database fields but they may actually have constant values or trim. Once you know the fields that you want to repeat, you switch to Document edit mode so that you can set the report attributes for them. You select the fields by using Field selection before you open the Format Report window. If there are no report attributes for the first selected field, you will see a response window that looks like this: You may respond by choosing YES or NO. If you choose NO, you return directly to the document without setting any report attributes. If you choose YES, the Format Report window will be displayed. The second action button at the top of the Format Report window is SET OFFSET. Choosing this button will temporarily close the window and allow you to position the cursor in the document. The cursor will initially be at the left character of the left most field that you had selected. You move the cursor downwards to define the vertical report spacing by pressing (down arrow). Each screen position that you move tells Surefire how much space to leave between successive records. Once the cursor is where you want it, press (Enter). If you would rather not finish the layout at this time, press (Esc) to cancel. In either case, the Format Report window will reappear. Surefire User's Guide Page 144 When the Format Report window is redisplayed, a new multiple choice button will appear saying Fill Down. In addition, the number of blank lines to leave between the data from each record is indicated by the text "Skipping 1 Lines". Choosing OK at this point sets the report attributes. All fields that are repeated will have the same repeat setting and thus will have the same spacing between data records. Each data record may take up more than one line of the report. The next search in this document would bring back all qualifying records, display each one on a line, filling records to the bottom of every page, and create pages as needed until all records were retrieved. The "Fill Down" button has another possible value of "Repeat field n times". If you wanted only a limited number of records to be displayed per page, press (Spacebar) to change Fill Down to Repeat field. Then enter the number of times in the data entry field. Using Trim Trim is constant text and graphics that adds emphasis to your report. You can have trim fields that have a repeat attribute to appear near each data record. Or, you can use trim to label report columns or to appear at the top or bottom of every report page. Trim might consist of lines, tic marks, text, etc. And, you can always use the Header and Footer regions of the document for report titles, etc. To use trim, you must first create text fields in your report document to hold the trim. Then, using the document, you put the desired text or graphics into the fields. Once this is done, you can specify the trim fields to be repeated along with the other data fields. Use the same method described above for data fields to show Surefire how these trim fields are laid out. For example, if you want to have lines or tic marks drawn after every record, simply create a text field below the repeated fields, use line drawing to draw a line in the text field, and set the repeat for this field along with the stored fields. Clearing the Repeat Specification Once you have associated a repeat attribute with your fields, you may wish to remove it from some or all of the fields. To do this you must first select the fields that already have a specified repeat setting. Then you display the Format Report window and choose the button CLEAR REPEAT. When you press OK, the repeat attribute for these fields will be cleared. Once you save the document, these fields will no longer be repeated when the report is generated. Displaying at the Top or Bottom of Pages The normal Header and Footer regions of Surefire documents are always repeated in the top and bottom margin for every page of your document. As a report is generated, you may want different header and footer information displayed at the top or bottom of each report page. Surefire User's Guide Page 145 This could either be calculated field values or trim data such as column headings. You use a report attribute to have a field displayed at the top or bottom of report pages. This attribute is also set via the Format Report window. Unlike the page Header and Footer, this information is displayed within the margins and only on those pages of the document into which the report is generated. At the left of the text "Display value at top of page", is a logical field. Choose "Y" to indicate that your selected fields will have their values displayed at the top of every page. The exact position will be the same position that the original field is from the top of its page. For example, if one of the fields were at column 50 and 2 lines from the top margin, then its value would always be displayed at column 50 and 2 lines from the margin on every page. Any repeated fields would begin below this field on each page. The next setting: "Display value at bottom of every page" is just the opposite. Use this to put field values at the bottom of every page. Displaying at the End of a Report To display text or the value of a field at the end of a report, just make sure that it is located below any repeated fields. Do not give the field any report attributes. As the report is generated, the text and fields will move toward the end of the document. The fields will be evaluated after all data records have been retrieved. Displaying When a Sort Field Changes You may want to display the values of certain fields when a sort field changes. Recall that a sort field is a data field associated with a query line which has a sort order of 1, 2, or 3. The on change attribute is used to mark off groups of data displayed in your report and is especially useful for fields containing @D database functions. The groups of data are determined by the sort field that you choose. For example, if you sort by name, then you will have a new group for each name. Likewise, if you sort by date, then there will be a new group whenever the date changes. When the cursor is over the on change attribute, you may press (ALT+Z) to zoom a pop-list of possible database fields. You will see the name of each field and its type. You may choose any of these fields. If this particular database field is not used as a sort field when you do a query, the on change attribute will be ignored and the field will not be displayed when the report is generated. As Surefire generates your report, each time that the value of the chosen sort field changes, the field with the on change attribute will be displayed, between the record with the old value and the first record with the new value. Note: When you start a search without using the Query window, you can specify this attribute for the field where you start the search. Also, fields with this attribute must be located below all repeated fields. Surefire User's Guide Page 146 Turning off Report Formatting Sometimes you may want to use a document that has report attributes to retrieve records one at a time. If this is the case, you may temporarily turn off report formatting by using an option in the Search Options window. To set this option, follow these steps: 1. Display the Search Options window. Press (ALT+D) to open the Data menu. Choose Search Options... to open the Search Options window. 2. Turn off report formatting. Answer 'N' to the question "Do Report Formatting?". Choose OK to set the change. Choosing OK will tell Surefire that you want the current document to behave as a document without report formatting. 3. Display your records. If you press (F8) you will see data records displayed as if there weren't any report attributes. The next time you read the document into Surefire, the report formatting will be turned back on. Generating a Report Once a document has report attributes, you generate the report simply by choosing "Search" from the Data menu or pressing (ALT+S) to start a search. You can have a query in the Query window or base the search directly on a field. The records that satisfy the query conditions will make up the report. As long as there is enough room in memory to handle the expanded document, you can view the results of your report as soon as all records are retrieved. Since Surefire generates a report directly into a document, it is recommended that you save your document once you have defined all report attributes and before you begin generating the report. Note: Even before the report is generated you cannot use (F8) and (F7) to sequentially view records when report attributes are specified (and used) for any field. After all records have been retrieved and the report has been generated, your cursor will be repositioned at the place where you started the search. This will typically be at the beginning of the document. You may press the (PageUp) and (PageDown) keys to view your report on the screen. You may stop the report while it is being generated by pressing an 'S' at any time. After it is stopped, you may view, edit, and print just as if the report generation had gone to completion. Sometimes you may set up a query intended to generate a long printed report. Before printing it, you may generate a few pages, then stop it and look at it to make sure it is really what you want. Then, after you are sure, do the Search & Print to generate the full report directly onto paper. Surefire User's Guide Page 147 Note: If the number of retrieved records is very large, there may not be sufficient memory to view the entire report. You will be able to see as much of the report as possible. If memory is exhausted, a message window will be displayed. You must use Search & Print to print the entire report. After a report is generated, all fields with report attributes are temporarily deleted from the document by Surefire. This happens because the purpose of these fields is solely to indicate to Surefire how to present the information in the report. Once the report is generated, these fields would just get in the way. The other fields that do not have report attributes remain intact for your use. If you had generated the report in the middle of some larger document, these other fields may still be used to search the database or perform calculations before you print the report. Button fields are very handy to have around. You can use buttons to re-generate the report based on specific named queries. In fact, buttons in report documents can be an essential part of a Smart document application. Resetting a Report Generally you want to re-get your document each time after you run a report. This is because the generation of a report automatically edits your document by inserting lines and moving text and fields. You can then further edit your report manually if you wish. But, when you want to generate your report another time, usually with a slightly different query, you must start with the original document. When you get a document using the Get File window, Surefire does not remember information about the query or search you have just performed. By choosing "Reset" from the File menu instead, you can tell Surefire to get the document again but leave the current query information intact. The is handy especially when you are testing the look of a report generated from a complex query. You can keep making minor changes to the query each time, and generate the report again and again until you are satisfied. This certainly overcomes the inconvenience of getting the report document and redefining a query each time you generate a report. Printing a Report There are two ways that a report may be printed. You can print a report after having a chance to view and annotate it on the screen. Or, you can tell Surefire to directly print the report as it is generated. Both ways assume that you have already defined the appropriate report attributes as described earlier in this chapter. Surefire User's Guide Page 148 Printing After Display Quite often you may want to generate a report, but then add text to explain specific results, organize the text a little differently, or delete portions of it that are really not of interest. In Surefire, all you need to do is be in Text edit mode after the report is generated. You can manipulate the result all you want using Surefire's word processing capabilities. Then, when you are ready, you can print the document. To print the report once it is viewed on screen, and you are in Text edit mode, choose "Print..." from the File menu to open the Print window. Then choose PRINT. This is exactly the way that any other document is printed. If there are any button fields in your document, the button labels will be removed in Text edit mode and will not be printed. Printing the Report Directly You can generate a report in such a way that it is printed at the same time. This is especially useful if your report is larger than memory allows. Before you do, be sure the report will be what you want, since printing often takes a long time. First, generate a few pages without printing and then stop it by typing an 'S'. When everything looks good, you're ready to go. To print the report directly while it is being generated, you first build your query in the Query window if you haven't already done so, or get a named query. Then choose "Print..." from the File menu. Choose SEARCH & PRINT. Surefire will qualify matching records according to the query conditions, generate the report and print the entire document. Of course, you have the option of stopping the print operation at any time. Saving a Report The generation of a report automatically edits your document by inserting lines and moving text and fields. It also deletes those fields that have report attributes. Once a report is generated, the document can not directly be used to generate another report. Only the original document can be used again and again to generate different reports. Therefore, when you are ready to save your report, Surefire insists that you save only the textual form of your document as a Report or as a Text File. Neither of these will retain field information. Saving as a Report will preserve the margins and special characters of a document. This is the option you will normally use. Saving as a Text File or General WP will save only the text of your report in ASCII format. This may be just what you want if you are going to send the report over a modem to someone who has a different word processor, for example. You use the Save File window from the File menu and enter the name by which you want your finished report to be saved. Set the file type Surefire User's Guide Page 149 multiple choice button to Report to specifically save the report without overwriting the original document. Then, give the report a name that is different than the name of the original document. Using Statistical Database Functions You can use the functions shown below in field commands to perform statistical calculations on field values that span more than one database record: Use function To @DSUM Find the sum of values for a field. @DAVG Find the average of values for a field. @DCOUNT Find the number of records retrieved so far (for a group). @DMIN Find the minimum value of a field. @DMAX Find the maximum value of a field. @DTOTAL Find the total number of records for the current query. These functions are often used in combination with fields that have an on change attribute to display statistical information based on groups of your report data. For example, you may want the total number of recipes that use apples, the average salary of employees in each department of a company, or the oldest and youngest people in your database. These functions are described in "Appendix A: Surefire Function Reference". Generating Reports at the Push of a Button With a button field and the @RESET function, you can perform the same operation as choosing "Reset" from the File menu. This operation allows you to re-get the current document after a report has been generated in such a way that current query information is not cleared. This way you can generate a report, reset the document, and then just change a query condition before regenerating the report. However, by itself, it may not be worth having a button field in your report just to support a menu shortcut. A real handy extension to this idea is to have one or more buttons set up at the top of your report to generate varieties of the same report. This can be done by using field commands with the @QUERY() function. The @QUERY() function will do a reset operation automatically if a report was generated. It will then start a database search based on the named query specified by its argument. For example, in our "conrept" document, you can have one button generate a report for the tri-state area of N.Y., N.J., and Connecticut. Another button can generate the report for the entire U.S., alphabetically by state. And so on. Surefire User's Guide Page 150 Chapter 23 - More About Printing When you have finished editing a document, or you have just generated a report, you usually want to print it so that you can have a paper copy. Paper copies are needed for mailing and may also be part of your record keeping procedures. By now you are quite familiar with printing a document in Surefire. The features of the Print window were introduced quickly in the word processing chapters. This chapter reviews some information you already know, as well as printing options not thoroughly discussed earlier. In addition, this chapter explains available fonts and printer drivers and how to configure Surefire with a particular printer. The Print Window You use the Print window to print Surefire documents and reports. The settings allow you to select which pages of your document to print, how to number those pages and whether your printer is set up for manual sheet feeding. The following sections describe each of these settings and the two action buttons that may be used to print your documents and reports. Pages to Print You can specify which pages of a document are to be printed. You do this by changing values in two entry fields of the Print window to the right of the label "Print from Page:". The default is "1 To: END" which means print the entire document. If you change these values, only certain pages of a document will be printed. The number in the first field must have a lower value than the number in the second field. For example, "2 to 7" says print the second through the seventh pages of the current document. Page selection is useful, if you want to revise part of a document or to substitute a corrected page into a printed document. Page Numbering You may also select the starting page number for the first page that is printed. This will be the number printed in the header or footer for the first page if you have enabled page numbering. Read "Chapter 9: Page Layout" for details about page numbering in headers and footers. For example, say the current document has 10 pages which are numbered 1 through 10. But this document really represents chapter 2 of a longer project, and the last page of chapter 1 is 14. You still want to print this entire document, but the starting page number should be 15. To set this, change the value in the field to the right of "Start Numbering:". The default value is "1". So, you would type "15" in place of the "1". Surefire User's Guide Page 151 If you choose PRINT now, the 10 pages of the document will be printed with the page numbers 15, 16, ... 24. As in our example, this feature is useful for printing chaptered text where each document represents a chapter but the page numbers must be continuous as if there were really a single larger document. Number of Copies You can select the number of copies of the current document that you want printed at one time. This means that after one copy of your document is sent to the printer, Surefire will send additional copies without you having to choose PRINT more than once. You will not be able to resume other operations in Surefire until all copies have been sent. To set the number of copies, change the value in the field following the label "How Many Copies:". The default is 1. Note: Do not confuse this with instances of a document that are formed during a merge. If you set this to be greater than 1 you will have more than one copy of each instance of a document. See the explanation of SEARCH & PRINT below. Pause Before Printing Some printers do not have automatic sheet feeders. If yours does not, you still may want to print onto a single sheet of paper, with a company letterhead, for example. You can tell Surefire that this is your intention if you say "Yes" to the Print window question "Pause before each page?". You must do this prior to choosing OK in the Print window. This will cause printing to automatically stop before each page is printed so that you can load a sheet of paper. If you are going to be using paper that is not on a continuous feed (i.e. tractor feed), you should also read the section later in this chapter entitled "Tractor Feed vs Sheet Feed". This section covers additional considerations for setting number of lines per page, margin adjustments, etc. PRINT and SEARCH & PRINT These action buttons will start a print operation of the currently displayed document. PRINT allows you to print the current document with any data that is currently displayed in fields of the document. PRINT will be your selection unless you are merging data or generating a report. Normally, the cursor is positioned on this button when the Print window is displayed. SEARCH & PRINT will merge data from a database according to the currently defined query into the fields of your document. This will usually result in the printing of multiple instances of your document with different sets of data. You may read "Chapter 19: Forms and Form Letters" and "Chapter 22: Generating Reports" for specific instructions on using this feature. Surefire User's Guide Page 152 Printing the Current Document If a report, text file or document is not currently displayed in Surefire, you must first read it into Surefire to be printed. If you are not familiar with the steps for reading a document, read the section "Opening a Document" in Chapter 5. You use the Print window, setting options as appropriate and choose PRINT to print your document to the current printer. You may also use the print file shortcut (ALT+F6) to print the currently displayed document without opening the Print window and without changing any default print window options. PRINT will print your document, just as you see it. This varies depending on whether you are using the document (use mode), editing the document (Document edit mode) or editing text (Text edit mode). The difference is solely based on how the fields are represented. In use mode, the fields contain their current values and all the fields are printed with underlines. No autosizing of fields will take place. In Text edit mode, all field values are in textual form and any autosizing will have been done. The fields will not be underlined. And finally, in Document edit mode, all fields are underlined and filled with a character indicating their type. No autosizing will take place and no values will be printed. SEARCH & PRINT will always switch to Text edit mode just before printing is done. Therefore, field values are autosized and printed without underlines. Stopping and Starting the Printer When printing begins, a window is displayed with the following message: "Printing in Progress - Type S to stop". This window will go away after the document is printed. If printing cannot be started, a message will say so. If this happens, you need to be sure that the printer is turned on and is hooked up properly. If you type "S", the information being sent to the printer is temporarily suspended. The printer may continue for a while to complete what was already sent to it. The following message is then displayed: "You have stopped printing. Abort?" At this time you can prevent anything more from being sent to the printer by choosing YES. If your printer keeps printing, you can stop it by resetting it or turning it off. Choosing NO will allow printing to continue from exactly where it stopped. Printers and Printer Drivers Surefire comes with several printer drivers. Before you print any Surefire document, you must select the appropriate driver for your printer. As long as you do not switch printers, you do not need to select your driver after you initially install and setup Surefire. An option on the Setup window may be used to select your printer. You can display the Setup window from the File menu. Surefire User's Guide Page 153 Here is a table of the available drivers and the printers with which they work. The available fonts with the character widths in cpi (characters per inch) are also shown. The fonts corresponding to the current printer driver are seen in the Format window. This window is accessed from the Page menu. Driver Printers Fonts/cpi PLAIN (dumb) default/10 ANSII ANSII Standard Pica/10, Elite/12 DIABLO Diablo 630 Pica/10, Elite/12, Condensed/12, Brother HR Series RICOH408 Ricoh LP4080R Courier/10, Prestige Elite/12, Letter Gothic/15 IBMPRO IBM Proprinter Series Pica/10, NLQ/10, Elite/12, NLQ/12, Condensed/17.1 IBMGRAPH IBM Graphics Printer Pica/10, NLQ/10, AT&T 473/478 Elite/12, NLQ/12, Okidata 92/192, 93/193 Condensed/17.1 EPSONRX Epson RX Series Pica/10, Pica Dbl+Emp/10, Epson MX Series Elite, Elite Dbl+Emp/12, Compressed/17.16 EPSONFX Epson FX Series Pica/10, NLQ/10, Epson LX Series Condensed/17, Wide/5 EPSONLQ Epson LQ Series Pica/10, Elite/12, Epson SQ2500 Condensed/17, Cond. Elite/20 HPLASER HP LaserJet Family 10 Pitch/10, 12 Pitch/12, Apricot Laser 16.66 Pitch/16.66 Epson GQ3500 Kyocera F-1010 Laser Nec Silentwriter Series Okidata Laserline 6 Olivetti PG 208 M2 Quadram QuadLaser 1 Tandy LP-1000 Tegra Genisis Wang LDP 8 Even if your printer is not shown in the table, your printer will likely still work with one of the above drivers. You need to know if your printer emulates another printer as many do. For example, it is very common for daisy wheel printers to emulate Diablo printers, dot matrix printers to emulate Epson printers, and laser printers to emulate HP LaserJet printers. Surefire User's Guide Page 154 If your printer does emulate another printer, then you should set the printer to use the emulation and select the printer driver in Surefire that corresponds to the emulated printer. If necessary, read your printer manual on supported emulation modes and how to set them. All the printer drivers listed in the table support underline and bold attributes. The only exception is PLAIN. The PLAIN driver supports the least intelligent printers. It neither supports attributes nor multiple fonts. If your printer does not support the IBM extended character set, you will not be able to print lines or special characters. Some printers particularly laser printers, will need to have this character set loaded. Consult you printer manual for more information on supported attributes and character sets. What Actually Gets Printed Printers with tractor feed allow you to print the full length of the page. That is, all 66 lines on an 8-1/2 by 11 sheet can have text. In this case, formatting your page with Surefire is very straight-forward. Use the Format window to set the page size to 8-1/2 by 11 inch pages as was explained already in "Chapter 9: Page Layout". You can specify your margins and font without worrying about any other considerations. Sometimes, you may want to feed 8-1/2 by 11 inch sheets of paper into you printer individually or with an automatic sheet feeder. This is often done to print letters on a company letterhead or to use other paper that may not be available for tractor feed. The problem is, most printers can't print the full 66 lines on a sheet-fed page. This is because the paper must be fed past the print head and held in place by the rollers in order to start printing. This is very similar to a typewriter. As a result, somewhat fewer than 66 lines are really available. To compensate for the inability of a printer to printer all 66 lines of a page, the format of your document must be adjusted. You can do this by following these steps: Step 1: How may lines? Determine how many lines can be printed on a sheet. Most often this information can be found in your printer manual. It may tell you how much space is skipped at the top and bottom of the page. Subtracting these amounts from 11 inches will give you the printable length of the page. Sometimes it may not be clear from the printer manual, or you don't have the manual. You can determine exactly how many lines can be printed, and exactly how much space is left at the top and bottom as follows: 1. Open a new document. Choose New from the File menu to start a new document. Surefire User's Guide Page 155 2. Set the page length. Choose Format... from the Page window to display the Format window. Set the page length in the Format window to 8-1/2 by 11 and set the top and bottom margins to 0. 3. Number the lines Number the lines of your page from 1 to 66. 4. Print a test page. Choose PRINT from the Print window to print a test page, using sheet feeding on your printer. The number of lines printed on the page will be what your printer can physically print. Dividing this number by 6 will give you the length of the print region in inches. You can measure the amount of space skipped at the top and bottom with a ruler. Now you know everything you need to know to format your document so that it comes out as you expect. Write down the size of the actual print region, and the space skipped at the top and bottom of the page for future reference. Step 2: Set the page length. In the Format window, set the page length to correspond to the number of lines that can be physically printed on a page. To do this, choose "Specific Setting:" for the value of the page size multiple choice button in the Format window. You will notice that two additional entry fields are now visible just to the right. Move the cursor to the "Length:" field and type in the length you determined in Step 1 above. Step 3: Adjust the margins. Using the data entry fields in the Format window, adjust the top and/or bottom margins smaller to account for the extra space that is on a page. To do this, first subtract the amount you measured at the top of the page from the current top margin. Then, subtract the amount of space from the bottom of the page from the current bottom margin. Step 4: Reformat the document. Now choose OK in the Format window to reformat your document. You will immediately notice that the document may now take up more pages than before since less text can fit on each page. You can now review your document. Each page will correspond to the page as it will be printed, except a little extra space will be at the top and bottom of the page. Save your document to retain the new formatting if you desire. Step 5: Print the document. Now you can load your first sheet of paper, align it horizontally and print. If you are feeding paper manually, just load the next page after the previous one is ejected, making sure your printer is on-line. See your printer manual for more information about how your particular printer behaves. Surefire User's Guide Page 156 Chapter 24 - More About Surefire Documents As you know, the basic entity of Surefire is the document. Documents may contain text, text and fields, and may be associated with a database. Fields of a document may contain field commands that make documents smarter and quite powerful. Documents may be used for data entry and reporting and may even evolve into complete applications by "linking" Smart Documents together. Depending upon their complexity, documents actually consist of one or more DOS files which are managed by Surefire as a group. As you edit, use and maintain a document, Surefire assures that all associated files are changed accordingly. This chapter will serve as a place to review much of what you have learned about documents. You will also learn more about how other associated files are managed by Surefire. The Modes of Editing and Using Documents If your document contains only text, you may only edit this text. That is, you may only perform normal word processing operations such as text insertion, deletion, find, replace, etc. In Surefire this is known as Text edit mode. There are also times when you have a document with fields but you want to edit the document along with the field values as text. To do this, you choose "Text" on the Operate menu. The Operate menu always shows the current mode of editing or use by preceding that choice with an 'X'. When you are only editing the text of a document, the Operate menu looks like the picture at the left. In the chapter "Introduction to Fields", you learned about using fields in a document. Documents which contain fields may be edited as text in Text edit, mode or as a document in Document edit mode. In the latter case, Surefire maintains information about the placement of fields. When Surefire is in Document edit mode, you can manipulate fields as well as perform all the normal word processing operations that are available in Text edit mode. A document with fields may Used. This concept of using a document was covered in greater detail throughout this manual. Using a document is what really distinguishes a Smart document from an ordinary document. When you use a document, you enter, view and manipulate the values in fields instead of the layout or text of the document. While using a document, you may only change field values. The Operate menu reflects this mode as well. Getting Documents When you get a document, Surefire will display the first page of the document with the margins that were set the last time you displayed it. Surefire will also read in files that define fields or data associated with the document. Surefire User's Guide Page 157 You may get a document by specifying the name of the document along with the Surefire command at the DOS prompt: > SUREFIRE MYDOC You may also type the name of the document in the Get File window (from the File menu). This window shows the current directory. This is the directory where Surefire will look for a document. This is the DOS directory that was set during Surefire installation or most recently specified in the Setup window. If a document has more than one associated file, all these files must be in the current directory. The Get File window has a multiple choice button that allows you to get a document, get a text file, or to import a data file. Just to the right of the label "Name:", is the field you use to enter the name of your document or file. If the multiple choice is set to Document, no file extension (such as .DOC) is needed and formatting and margin information will be preserved. See "Chapter 25: Surefire System Topics" for a complete description of all Surefire file extensions. The multiple choice button on the Get File window also has choices for Text File and Data File. The Text File choice allows you to read in a file created by another word processor or text editor. The Data choice allows data from another program to be imported into the current document's database. The import process is described in "Chapter 19: Advanced Database Topics". If the multiple choice button is set to Text File, Surefire will search for the named file and assume it is an ASCII file with no special formatting information. If the name has no period '.' or other extension, Surefire assumes the extension ".TXT". For this type of file, the margins will be set to the current margins at the time of the Get. By pressing the Zoom key (ALT+Z) when the cursor is on the file name entry field, a pop-list of all documents, text or data files will appear. Text files with the extension ".TXT" will be shown when the chosen file type is Text File. Likewise, ASCII data files with the extension ".DTA" will be shown when the file type is Data File. Otherwise, documents will be listed. As with all pop-lists in Surefire, you may press the (down arrow) key to move the cursor to the document or file that you want and press (Enter) to choose it. If you do not wish to make a choice, you simply press (Esc). The pop-list showing documents has additional important information about each particular document. The date and time that the document was last saved is always displayed. But, there is additional information for documents containing fields and databases. The 'Y' in the first column indicates that the document has fields. A 'Y' in the second column tells you that the document is a base document that defines a database. A 'P' in the second column indicates that the document has fields projected from another database. The number of documents that project data from a base document are shown in the third column. Surefire User's Guide Page 158 Saving Documents In the Save File window there are 5 possible file types from which you may choose. They are Document, Report, Text File, General WP and Data. Whatever file type you choose, Surefire will save that file or document in the current directory. If you choose Document, Surefire will save the current document and any files associated with it. It will remember graphic attributes and header, footer and margin information as well. If Text File or General WP is your choice, only a textual version of the document will be saved as ASCII text. No graphic attributes (see "Chapter 8: Adding Emphasis") or formatting information such as margins will be saved. Special characters will be saved but may not be kept intact by other programs. In a Text File, each line of the Surefire document will be terminated with a newline character (CR-LF). This format is recognized by various text editors as well as DOS commands such as type. General WP is similar to Text File, however, there will not be a newline character after each line. Surefire will terminate every paragraph with a single newline character so that a paragraph will become a very long line. This format is recognized by many word processors and will ensure that words in a paragraph are properly wrapped when imported. In addition, Surefire will replace leading spaces on each line by (Tab) characters. This will be based on the current tab size you have set in the Setup window. You may choose to save a document as a Report when you want to keep the graphic attributes and formatting information but not any associated field information. Surefire will look to see if there are already documents with the same name that have fields or a database. If so, you must choose a different name. Saving a document this way is useful when you wish to annotate a document after you view data records, without losing the correspondence between the document and its fields. Use Data File when you want to export data from a Surefire database to another program. See "Chapter 21: Advanced Database Topics" for a thorough description of importing and exporting data. Copying Documents You can use the Get File and Save File window to copy files or documents. Just Get the desired file or document and Save it directly with a different name. If you are copying a document with fields, your copy will have the same format and fields as the original. The fields of the copy will have the same attributes, names, sizes, layout and field commands as in the original document. If the original document is a base document defining a database, your copy will not include a copy of the database data. Its fields, however, will be defined so that you can add or import data to create a new database. This database will have the same structure as the database Surefire User's Guide Page 159 of the original document. Since the format of the copy is the same, it is a simple matter to copy the data from the original document's database to the new database. All that you need to do is to export some or all of the data from the original and import that data into the copy. See "Chapter 21: Advanced Database Topics" for complete information on importing and exporting data. Renaming Documents If you want to rename a Surefire document, use the Rename File window. The Rename File window has two data entry fields. Type the current name of the file or document in the first field next to the label "Old Name:". You may press (ALT+Z) to show the pop-list of files in the Current Directory. Enter the desired new name in the second field next to the label "New Name:". The rename within Surefire works differently than a DOS rename command (ren). If the file type is Document, Surefire will rename all associated files that define fields or a database, as well as the document itself. In addition, Surefire will not allow you to rename a file to a name that is already used. A message window will be displayed if you try to rename a base document that has associated projected documents. At the time of the warning, you may choose to CANCEL the rename. If you continue with the rename in this case, you will need to modify each of the projected documents to reference the new name. (Use the Field Modify window from the Field menu to do this). Deleting Documents If you want to delete a Surefire document, use the Delete File window. The Delete File window has a data entry field where you can type the name of the file or document that you wish to delete. You may press (ALT+Z) to show the pop-list of files in the current directory. Note: The Delete operation within Surefire works differently than a DOS delete command (del). If the file type is Document, Surefire will delete all associated files such as those that define fields or a database, as well as the document itself. No matter what the file type is, a message window will be displayed to make sure that you really want to continue with the delete operation. A special message window will be displayed if you try to delete a base document that has associated projected documents. At the time of the warning, you may choose to CANCEL the delete. If you continue with the delete in this case, you will need to modify each of the projected documents to remove all references to fields projected from the deleted document. You can either delete all of the projected fields or use the Field Modify window to remove all references to the deleted document. Surefire User's Guide Page 160 Creating New Documents Surefire is immediately ready for the creation of a document if you start it from the DOS prompt without any document name. You will see the representation of a standard 8-1/2 by 11 inch page with margins. > SUREFIRE If Surefire is already running, choose "New" from the File menu to clear the current document from the screen but keep the current page formatting and margins. Before this occurs, you will be warned to save the current document, if you haven't already done so. In either case, you are now ready to edit the new, as-yet-unnamed, document. That is, you may immediately enter text, graphics, do text operations, create fields, etc. Later, you can save the new document and give it a name. The chapters on word processing (4 through 9) walk you through all of the steps of creating and editing your document. Protecting Documents Surefire protects your documents and data in a variety of ways. The lack of highlighting for inactive menu items keeps you from selecting inappropriate actions. When menu items are inactive, they cannot be selected. For example, the "Use Document" choice on the Operate menu is not available when there are no fields. Notice that the 'U' is not highlighted. Whenever possible, Surefire warns you through message windows of operations that may affect the integrity of a document. Surefire will warn you of any side effects before it continues with the action. Throughout this manual are many instances of the actual message windows that are displayed in these cases. Note: You are also encouraged to routinely make backups of your documents to prevent loss in case of hardware failure or inadvertent editing operations. See the next chapter for information regarding backup procedures. Specifying Document Help If you are going to be creating smart document applications, you might be interested in having document help available for your application. Document help is context help that can be specified for your own documents. You have already seen how Surefire system help is always available by pressing (F1). The help is different depending on the part of Surefire being displayed at the time. In a similar way, a context in your document changes when topics or areas of your document or application change. You specify the appropriate changes in context within your Smart Document application with the @HELP function. Surefire User's Guide Page 161 Once specified, document help may be displayed by using the function key (F2). You use Surefire itself to write the text that will be displayed in the help window. Each context of your help is on a separate page of this help document. Generally, you use the @HELP function in the field command for a button or immediate execution field to specify each context change. As your user moves throughout your document switching between pages or other documents, the help context can change. There is one help file per document application. This means that when you initially run Surefire with a document specified at the DOS command prompt, or you explicitly read a document using the Get File window, Surefire will set the current document's help file to the one associated with this document, if there is one. The association comes from the help file having the same name as the document. For example, if your document were named "accounts", the associated help file would be "accounts.hlp". Note: As long as you display other documents by pressing buttons that execute @GODOC or @JOIN functions, or you return to a previous document by pressing (Esc), this help file and any previous help contexts will be preserved. If you exit from Surefire, or explicitly read a document using the Get File window or you choose New from the File menu, Surefire will forget any help context information associated with the previous document. Surefire will change the help file to be the one associated with this new document, if any. Help File Format A help file is merely a Surefire document with a specific name and format. A template for help files is provided and is called "document.hlp". This file is located in the Surefire installation directory. All help documents must follow the formatting rules shown below. Rules for Surefire Help Files 1) The file name must be the same name as the document but with a ".hlp" extension. 2) There must be exactly 66 lines per page. 3) There must be exactly 70 characters within the margins. 4) There may be no header or footer. 5) Both left and right margins should be .5 inches. 6) The font must be 10 cpi. 7) All pages must have STOP's. The first page of the help file will never appear in the Help window. This page is used for notes describing the particular help file. Usually, it is used to summarize the meaning of each context used in this help file. You write the text for the help window in the help file on the page corresponding to the context with which it is to be associated. The context is a number that you specify by using the @HELP function. Surefire User's Guide Page 162 You may not care about a context if you simply want to specify some overall information about a document. You can essentially ignore using a context by writing whatever text you want on page 2 of the help file. Whenever (F2) is pressed, the contents of this page will be shown in the Help window. Specifying a Document Help Context The document help context is specified by using the function "@HELP(context)" where "context" is the number of the page in the document help file to be displayed in the Document Help window when (F2) is pressed. For normal contexts, the context number must be 2 or greater and is always initially set to 2. For example, if your document were "accounts" and one area was payroll and another was ledger, you can have the help text for payroll be at page 3 of the help file (@HELP(3)) and the help text for ledger be at page 4 of the help file (@HELP(4)). The help file is "accounts.hlp" It is often the case that @HELP is used in conjunction with the @GODOC function since displaying another document is a natural change in context. When the @HELP function specifies a new context after the @GODOC in the same field command, it changes the context for the next document. The previous context will be restored to what it was set to just before the @GODOC, when you return back to that document by pressing (Esc). Use @HELP(1) when you want to say that a part of your document application will use a new help file. The name of this file is constructed from the name of the current document. Use this method for breaking up the help file of large Smart Document applications or applications that may be run either independently or as part of another application. Surefire User's Guide Page 163 Chapter 25 - Surefire System Topics Well, you have reached the end of the Surefire User's Guide. The other chapters of this guide have covered all that you need to know in your day to day usage of Surefire. This chapter covers information that you will probably not refer to very often. These topics include the backing up and recovery of your files, more about how Surefire files appear to DOS and some limits you may encounter in using Surefire. Backing Up Your Files There are two aspects to backing up files in Surefire. One protects you from accidently deleting or saving files when you really didn't want to. The other protects you from unexpected hardware or system errors resulting in catastrophic effects to some or all of your files. You should use the appropriate method at the proper times to protect your investment in time when using your computer. Manual Backups You should always make backup copies of your important Surefire documents and their associated files in case of a catastrophic machine failure. Time and time again these types of failures happen when you have been using your computer intensely for days at a time. You are heavily involved in your work and backing up your files just takes too much time. Don't fall into this trap! Make sure all of the files in your working directory are copied or backed up to a floppy disk or tape unit periodically. Every once in a while say to yourself "If my computer failed totally and I lost all my data how much time will it take to do every thing over again?" If you can't afford this scenario, do a backup! You can backup your files by using the DOS command cd to get to your working directory and then using copy or backup. Refer to your DOS manual for more information about these commands. Automatic File Backup and Recovery If you have chosen the auto backup option from the Setup window, documents modified during a Surefire session will be backed up, in the current directory, automatically. See the section "System Setup" in "Chapter 2: Getting Started" for details on setting this option. Whenever you save a document, Surefire will set aside the previous version of that document if one exists. Surefire makes copies of each of the files associated with the document. With Auto Backup, if you somehow save a document incorrectly, for example, by using the name of an existing document and thus un-intentionally overwriting a document, you can recover the "lost" document. This will also be handy if you inadvertently delete a document. Note: Whether or not you use this option, Surefire will always backup a database when a base document is deleted and during a database restructuring operation. Surefire User's Guide Page 164 Having files backed-up in this way means that you can recover the previous version of your document. This previous version will have an exclamation '!' character followed by the usual 2 characters of the file extension. If you don't want the changes that you just saved to disk by saving your document via the Save File window you can exit Surefire and restore your original document. From DOS, you use the copy command to restore the changed document to its previous version. You also use the del command to remove all of the index files. Surefire will automatically create new ones when needed. To recover a backed up document, such as CLIENT, enter the following DOS commands at the DOS prompt: >COPY CLIENT.!OC CLIENT.DOC >COPY CLIENT.!LD CLIENT.FLD >COPY CLIENT.!BF CLIENT.DBF >DEL CLIENT.ND* Note: If you are short of disk space you may not have enough room for the auto backed up copies. You can turn auto backup off and then delete some of your backup files to free up disk space. If you do, we recommend that you first do a manual backup (see the previous section). Surefire Files Surefire documents are really composed of a group of files that contain the various information needed to present the text, fields and data of the documents. Other files support the available printers, data import and export operations, on-line help and database indexing for quick data access. You may see various files when you look at the DOS directories where you use Surefire. The following table lists the types of files you may see and what their three character DOS extensions are. The asterisk (*) shows that the file name can be anything. File Type File Name or Extension Document file (text portion) *.DOC Field file *.FLD Database file *.DBF Index file *.NDn ASCII text file *.TXT Export/Import data file *.DTA Printer definitions *.PD Help files *.HLP Surefire Program SUREFIRE.EXE Configuration File SUREFIRE.CFG Surefire User's Guide Page 165 Document File Format - WordStar Compatible The file structure used for all document files, which are files with the extension ".doc" are compatible with WordStar 5 and earlier versions. What this means is that Surefire .doc files can be read directly into WordStar without any conversion. Likewise,WordStar documents can be read directly into Surefire as a Document. Any attributes or formatting that can be specified in WordStar that are not available in Surefire will be ignored by Surefire. Surefire's specifications for formatting and attributes are very straight-forward. WordStar was chosen because many other word processors and editors can convert to and from WordStar format, and thus to and from Surefire. Using this format, the simple formatting and attributes supported by Surefire won't be lost when transferred to other systems. Database File Format - DBase III Compatible The file structure for all database files, ".dbf" and ".nd?", are Dbase III compatible. This means that these files can be directly accessed by Dbase III or any other software that works with Dbase III files, including Dbase IV. Surefire can also access Dbase files created by these other programs, provided that document fields are defined to be consistent with the database definitions. To use these .dbf files directly, the document fields must be the same type, size and with cell names specified to correspond to those in the database definition. Databases defined by Dbase III must have field names with at least three characters. All characters of these field names must be alphabetic. We recommend that any index files from Dbase III are not used, since Surefire will automatically create them as needed. Locking Documents Sometimes you may have a set of Smart documents that you and perhaps others will use on a regular basis to do your work. It is often desirable to set up these documents so that they cannot be altered. You can lock documents by using the DOS command attrib to set the document files (eg. files with the extension .DOC) to be read-only. This will prevent Surefire from saving any files associated with the document. See your DOS manual for more information about the attrib command. Surefire User's Guide Page 166 System Constraints We all wish that there were no limits in the machines or programs that we use. We recognize, however, that nothing can work efficiently if everything was done to the furthest extent. For this reason we will discuss some of the limits that you may encounter while using Surefire. The tables below summarize Surefire System limits. There is room for approximately 15 to 20 standard 8-1/2 by 11 inch pages in 640K RAM. When documents approach this limit, we recommend that your document is broken down into more than one document. This can be done by deleting the second portion of the document and saving the document with a different name such as "mydoc2". Then get the original document, delete the first portion and save this document with a descriptive name such as "mydoc1". You can then delete the original document so as not to be confused. You will be warned with a message window if you are about to run out of memory. Since memory is generally left fragmented, it is best to save your document, exit Surefire and then re-run Surefire. Word Processor Limits Maximum page width: 260 characters Maximum page length: 96 lines Minimum page width: 10 characters Minimum page length: 3 lines Minimum space between left and right margins: 10 characters Minimum space between top and bottom margins: 3 lines Maximum number of pages per document: 250 but normally limited by memory (varies by page size) Maximum number of clipboard objects: 20 Field Limits Maximum number of fields per document: 500 Total number of non-stored fields in a document: limited only by memory Maximum size of a text field (non-stored): size of the page Maximum size of a text field (stored): 254 characters Maximum width of numeric field: 16 characters (without '%','$',',') Maximum number of cells in multiline numeric field: limited by page length (96) Maximum number of items in a text field pop-list: 30 Database Limits Database file size is limited only by the size of your disk Total number of stored or projected fields per document: 128 Maximum number of records is 1 billion (limited by disk) Maximum record size: 4,000 bytes Maximum size of a stored text field is 254 characters Maximum number of named queries: 20 per document While Dbase III file compatible, Surefire does not use memo fields Surefire User's Guide Page 167 Appendix A - Surefire Function Reference Field commands can be simple or complex. They can manipulate various types of information including numbers, dates and text. They can also control database access and link documents together. This chapter describes all of the functions that are available in Surefire that you may use in field commands. The various aspects of field commands are described in "Chapter 14: Introducing Field Commands" and in "Chapter 15: Using Field Commands". General Mathematical Functions These functions do the most general mathematical manipulations. Any of these functions can be used in the Calculator. Absolute Value @ABS(n) - Return the absolute value of n. Example: @ABS(-15) returns 15 Integer Value @INT(n) - Truncate the decimal part of n and return the integer value. Example: @INT(11.55) returns 11. Remainder @MOD(dividend, divisor) - Return the integer that represents the amount left over when the dividend is divided by divisor. Example: @MOD(27, 5) returns 2. Rounding @ROUND(n, place) - Round n to the nearest value with the number of decimal places defined by place. Example: @ROUND(77.456, 2) returns 77.46. Square Root @SQRT(n) - Return the square root of n. Example: @SQRT(64) returns 8. Surefire User's Guide Page 168 Trigonometric Functions These are the basic trigonometric functions. Any of these functions can be used in the Calculator. Pi @PI - Return the value of Pi. Pi is specified as 3.141592653589794. Sine @SIN(n) - Return the sine of n, where n is an angle in radians. Cosine @COS(n) - Return the cosine of n, where n is an angle in radians. Tangent @TAN(n) - Return the tangent of n, where n is an angle in radians. Logarithmic Functions These are the logarithmic functions. Any of these functions can be used in the Calculator. Logarithm @LOG(n) - Return the logarithm (base 10) of the positive number n. Example: @LOG(300) returns 2.4771212547. Power of e @EXP(n) - Return the value of "e" raised to the power of n. Example: @EXP(6) returns 403.42879349. Natural Logarithm @LN(n) Return the natural logarithm (base "e") of n. Example: @LN(100) returns 4.605170186. Surefire User's Guide Page 169 Financial Functions The following are available functions to do financial calculations. Any of these functions can be used in the Calculator. Future Value @FV(pmt, int, term) - Return the future value of an investment given the payment, pmt, the periodic interest rate, int, and the term of the loan, term. Payment Amounts @PMT(prin, int, term) - Return the payment of a loan given the principle, prin, the periodic interest rate, int, and the term of the loan, term. Present Value @PV(pmt, int, term) - Return the present value of an investment given the payment, pmt, the periodic interest rate, int, and the term of the loan, term. Compound Growth Rate @RATE(fv, pv, term) - Return the compound growth rate given the future value, fv, the present value, pv, and the term of the loan, term. Statistical Functions Statistical functions are a class of numeric functions that operate on a group of numbers. Generally, the group of numbers is specified as one or more cell ranges or field references separated by commas. For example, the group (A1:B2, C) is made of all the cells in the range of A1 through B2 and the field C. This group of cells can not span pages. For the examples given with these functions, let's use the fields and cells shown below: Average @AVG(references) - Return the average of all the numbers found in the cells specified by references. Example: @AVG(A1:B2) returns 15 Count @COUNT(references) - Return the count of all cells specified by references. Examples: @COUNT(A) returns 2. @COUNT(A1:B2, C) returns 5. Surefire User's Guide Page 170 Maximum @MAX(references) - Return the maximum of all the numbers found in the cells specified by references. Examples: @MAX(A1:B2) returns 30. @MAX(A1:B2, D) returns 62. Minimum @MIN(references) - Return the minimum of all the numbers found in the cells specified by references. Examples: @MIN(A1:B2) returns 5. @MIN(C, D) returns 20. Sum @SUM(references) - Return the sum of all the numbers found in the cells specified by references. Examples: @SUM(A1:B2) returns 60. @SUM(A, C, D) returns 107. The next two functions operate on a single range of cells or a single field reference. In addition, their results will be affected by the current execution order for the page on which the cells are found. A vertical order will give a different result than a horizontal order. See "Chapter 16: Spreadsheets" for information on how to set the execution order. Standard Deviation @STD(cell1:cell2) or @STD(field) - Return the standard deviation of all the numbers contained in cell1:cell2 or in all cells of field. Example: @STD(A1:B2) returns 9. Variance @VAR(cell1:cell2) or @VAR(field) - Return the variance of all numbers contained in cell1:cell2 or in all cells of field. Example: @VAR(A1:B2) returns 88. Date Functions A date function either produces a date as a result or requires a date value or a reference to a date field in at least one argument. When a date value results from a function, it may be displayed in a date field in one of three formats. The following are the date functions available in Surefire. The arguments date, date1 and date2 in these functions represent date field references or date values resulting from any of the functions that return dates, such as @TODAY, @SUBDAYS, etc. Surefire User's Guide Page 171 Add Days to a Date @ADDDAYS(date,days) - Returns the date that is days number of days after date. Example: Date field testdate has the value 5/7/90; @ADDDAYS(testdate, 15) returns 5/22/90. Date is After? @AFTER(date1,date2) - Return the logical value TRUE if date1 is after date2, otherwise return FALSE. Example: Date field testdate1 has value 3/21/85; testdate2 has 4/20/85. @AFTER( testdate1, testdate2 ) returns FALSE. Date is Before? @BEFORE(date1,date2) - Return the logical value TRUE if date1 is earlier than date2, otherwise return FALSE Example: Date field testdate1 has value 3/21/85; testdate2 has 4/20/85. @BEFORE( testdate1, testdate2 ) returns TRUE. Specify a Date @DATE(month,day,year) - Returns a date corresponding to the integer numbers representing month, day and year. Year must be either 2 or 4 digits. Example: @DATE(8, 6, 54) returns 8/6/54 (or August 6, 1954 or aug-06-54). Day of Month @DAY(date) - Returns an integer number corresponding to the day specified in date. Example: Date field testdate1 has value 5/12/34; @DAY(testdate1) returns 12. Find Days between Dates @DIFDATE(date1,date2) - Return an integer that is the number of days between date1 and date2. Example: Date field testdate1 has value January 5, 1987; Date field testdate2 has value December 19, 1986. @DIFDATE(testdate1, testdate2) returns 17 (days). Surefire User's Guide Page 172 Month of Year @MONTH(date) - Returns an integer number corresponding to the month specified in date. Example: Date field testdate1 has value 3/21/85; @MONTH(testdate1) returns 3 (month is March) Dates are Same? @SAME(date1, date2) - Return the logical value TRUE if date1 and date2 are the same, otherwise return FALSE. Example: Date field testdate1 has value 3/21/85; testdate2 has 10/14/78. @SAME(testdate1, testdate2) returns FALSE. Subtract Days from a Date @SUBDAYS(date, days) - Returns the date that is days number of days before date. Example: Date field testdate has value 13-mar-55. @SUBDAYS(testdate, 5) returns 08-mar-55 (or March 8, 1955 or 8/8/55). Today's Date @TODAY - Return today's date as a date. Example: Today is New Year's Day 1995. @TODAY returns 1/1/95 (or 1-jan-95 or January 1, 1995). Year @YEAR(date) - Return an integer number corresponding to the year specified in date. Example: Date field testdate has value 3/21/85; @YEAR( testdate ) returns 1985. Text of a Date @DATESTR(date) - Return a text string that represents date. This string can be assigned to a text field or written on a page of the document. Example: Date field testdate has value March 9, 1977; @DATESTR(testdate) returns "March 9, 1977" Surefire User's Guide Page 173 Text of a Month @MONTHSTR(m) - Convert a number m to the string of the corresponding month. A number greater than 12 will produce the month based on modulo 12. This string can be assigned to a text field or written on a page of the document. Examples: @MONTHSTR(6) returns "June". @MONTHSTR(15) returns "March". Text of a Day @DAYSTR(date) - Return the day of the week as a string based on the given date. This string can be assigned to a text field or written on a page of the document. Example: Date field testdate has value August 10, 1990. @DAYSTR( testdate ) returns "Friday". Text Functions A text function is defined as a function in which the result or at least one of its arguments requires a text string or reference to a text field. In fact, there are some text strings that yield numeric results. These numeric results can be used in mathematical expressions. Also, if a text function requires a number as an argument, this argument can be any numeric function or mathematical expression. The arguments text or str may be quoted strings or references to text fields. The argument start may be a number of 0 or greater where 0 means the first character of the string. Find a String @FIND(str, text, start) - Find string str within text beginning at position start. Return the integer number corresponding to the position in text of where the string was found. If the string is not found, -1 is returned. Example: @FIND("most", "foremost", 0) returns 4. Obtain a String @SUBSTR(text, start, len) - Return a text string within text beginning at the position start whose length is len. Example: @SUBSTR("activity", 2, 3) returns "tiv". Surefire User's Guide Page 174 Replace a String @REPLACE(text, start, len, str) - Return the text string after replacing the number of characters len beginning at position start in text with another string str. Example: @REPLACE( "generate", 0,3, "coop") returns "cooperate". Obtain Length of String @LENGTH(text) - Return the number of characters in the text string text. Example: Text field text1 has the value "ghost". @LENGTH(text1) returns 5. Remove Trailing Blanks @TRIM(text) - Remove any blank spaces at the end of text. Example: @TRIM("people in the news ") returns "people in the news". Compare Two Strings @EXACT(text1, text2) - Return the logical value TRUE if text1 and text2 are the same, otherwise return FALSE. Example: @EXACT("mice", "mouse") returns FALSE. Force String to Upper Case @UPPER(text) - Return a text string after changing all the characters of text to upper case. Example: @UPPER("house") returns "HOUSE". Force String to Lower Case @LOWER(text) - Return a text string after changing all the characters of text to lower case. Example: @LOWER("MixeD") returns "mixed". Convert a Number to a String @NUMSTR(n) - Return a text string that represents the number n. Use this function to convert numeric field values to text field values. Example: @NUMSTR(15) returns "15". Surefire User's Guide Page 175 Put String to a Page @PUTSTR(page, text, col, line) - Put the text string text on page page beginning at column col, and line line. Example: Text field teststring has the value "This is a Test". @PUTSTR( 5, teststring, 30, 20) will put the string "This is a Test" at line 20 and column 30 of page 5 of the current document. Text Buffer Functions These functions manipulate text in text buffers. Text buffers are similar to clipboard objects except they are only manipulated by the following functions. They are useful in carrying information between documents. In all of these functions, the number specified by buffer may be between 1 and 25. All of these functions return TRUE if the operation was successful. Otherwise, they return FALSE. Copy Text to Buffer @COPY(page, col1, line1, col2, line2, buffer) - Do a Block selection and Copy the text on the page page from the rectangle whose upper left corner is at col1, line1 and whose lower right corner is at col2, line2 to the buffer buffer. Example: @COPY(1, 10, 1, 20, 2, 5) will copy the rectangle from columns 10 through 20 on lines 1 and 2 of page 1 to buffer 5. This is a block of text 11 characters wide and 2 lines high. Paste Buffer onto Page @PASTE(page, col, line, buffer, copyattr) - Paste the text from the buffer buffer that was copied via @COPY or @FCOPY on the page page starting at col, line. If copyattr is @TRUE, write the attributes that were also copied to the buffer. Otherwise, the text is written using whatever attributes are already there at that place on the page. The contents of buffer are retained until other information is copied into that buffer. Example: @PASTE(2, 30, 10, 5, @FALSE) will paste the contents of buffer 5 at column 30 line 10 of page 2 without changing the attributes at that location. Copy Text from Field to Buffer @FCOPY(field, buffer) or @FCOPY(, buffer) - Same as @COPY except the rectangle is that of field. If field is not specified, the buffer buffer is cleared. Example: The numeric field digits displays the value $376.30. @FCOPY(digits, 10) puts "$376.30" into buffer 10. Surefire User's Guide Page 176 Paste Buffer into Field @FPASTE(field, buffer, copyattr) - Same as @PASTE except the location of the Paste is the upper left corner of field. The value of field is also set. Example: Birthdate is a long format date field. Buffer 16 contains "03/09/80". @FPASTE(birthdate, 16, @FALSE) will display "March 9, 1980" in birthdate. Time Functions While Surefire does not have a field type specifically for time, it is often useful to have values based on time. These functions return text strings based on the current time which can then be assigned to text fields or displayed on a document page. Current Time @TIME - Return a string corresponding to current time in the form hh:mm:ss. Example: It is now 5:30 AM. @TIME returns "5:30:00". Time Stamp @NOW - Return a string corresponding to the current date and time in the form yymmddhhmmss. This is often useful to generate a unique account number. Example: It is now 12:52 on May 9, 1990. @NOW returns "900509125200" Control Functions Control functions perform some immediate action. Because the result is an action, these functions are used with button fields or with the Execute on Enter prefix "[". Control functions generally return a logical value. If this is a TRUE value, the function was executed as expected. If a FALSE was returned, there was some sort of problem. A FALSE returned from an @GODOC, @RETURN, or the database control function @JOIN will stop execution of the remaining commands for that button or immediate command string ([) if there are any. Otherwise, Surefire will display "COMMAND ERROR" in the status line but will attempt to continue processing the remainder of the command. The control functions available in Surefire are on the following pages. Surefire User's Guide Page 177 Go To a Page @GOPAGE(page) - Scroll the document and put the cursor in the first field on the page whose number is page. If there are no fields on that page, put the cursor at the top of the page. Return TRUE if successful, and FALSE if the page does not exist. Example: @GOPAGE(5) will display page 5 of the current document. Go To a Field @GOFIELD(field) - Put the cursor in the specified field. If the field does not exist return FALSE, otherwise return TRUE. Example: @GOFIELD(account) puts the cursor on the field named account. Go To a Document @GODOC(name) - Get the document whose name is specified by name. Return FALSE if the document is not found, otherwise return TRUE. You may specify a document in a different directory by giving a relative pathname. If you do this, the current directory will be changed before Surefire looks for and reads the document. The name of the document must be in quotes ("). Examples: Currently looking at document news. The directory is topdir. 1) @GODOC("people") will display the first page of the document people. 2) @GODOC("newdir\finance") will switch to the directory newdir and then display the document finance. Advanced Use: If you have already accessed this document during this session, Surefire remembers the most recent database query executed for the document. Use the prefix (!) to avoid re-execution of the query when this document is displayed. Return to Previous Document @RETURN - Read the document that executed the @GODOC function that got the current document. Return TRUE if successful, otherwise return FALSE. If @GODOC or @JOIN caused a change in directory, the previous directory will be restored as the current directory. Examples: 1) @RETURN from example 1 above redisplays the document news. 2) @RETURN from example 2 above will switch to directory topdir and redisplay the document news. Surefire User's Guide Page 178 Return to Document at Level @RETURN(levels) - Read the document at the specified number of levels above the current document. Return TRUE if successful, otherwise return FALSE. If @GODOC or @JOIN caused a change in directory, the previous current directory will be restored. If levels is 1, this function is the same as the function @RETURN without arguments. Example: Do @GODOC from document A to document B. Then do @GODOC from document B to document C. @RETURN(2) from document C will go back 2 levels and redisplay document A. Run a DOS Command @RUN(command) - Run the DOS command or program that is specified in the text string command. Command may also be a text field reference. After the command is executed, you will be asked to press a key to return to Surefire. Example: @RUN("myprogram") will run the executable program named myprogram. Note: You can only run a program that fits in memory along with Surefire. Reset the Document @RESET or @RESET(report) - Re-get the current document but don't give any warnings and don't clear the current query information. If report is @TRUE, pre-specified report formatting is enabled while @FALSE disables any report generation. This first version of the function is used to return the fields to a document with report formatting so that you can Search & Print the report or generate a different report by changing the query. The second version allows you to easily switch report attributes on and off in a document that is part of a bigger application. See "Chapter 22: Generating Reports" for more information on reports. Set Help Context @HELP(context) - Set the context to context which is the page number of the document help file. This page is displayed in the Document Help window when (F2) is pressed. See "Chapter 24: More About Surefire Documents" for complete information on using document help. Surefire User's Guide Page 179 Present a Document @PRESENT(msecs) - Show each page of the current document for a duration of msecs. After the last page is displayed the cycle begins again from page 1. Use this to present a "slide show" of the pages in your document. Usually, the document will have pages that are the size of the screen. If you want to pause the presentation on a specific screen, press (Spacebar). The automatic presentation will continue when you press (Spacebar) again. The presentation will last until you press (Esc). Then, you will be able to move through the document normally with the cursor movement and paging keys. Example: Have a document with 5 screen size pages. @PRESENT(500) will display page 1 for 1/2 a second, then page 2 for 1/2 a second, page3, page4, up through page 5 and then repeat at page 1. You can use the @PRESENT function to do screen animation. Just set up your document as a series of screen pages that change in a certain way. Then use @PRESENT with a small value for msecs. Database Statistical Functions All of the following functions, except @DSUBCOUNT, are equivalent to the non-database statistical functions. The difference is that they operate on the values of the specified field for all the records retrieved by the current query. Note: These functions may only be used if a document has report attributes specified. For the examples with the following functions, the database records retrieved have these fields and values: Group Age A 50 B 60 C 35 A 12 C 46 B 21 Surefire User's Guide Page 180 @DAVG(field) - Average value of field over retrieved records. Example: @DAVG(age) returns 37.33 @DMAX(field) - Maximum value of field over retrieved records. Example: @DMAX(age) returns 60. @DMIN(field) - Minimum value of field over retrieved records. Example: @DMIN(age) returns 12. @DSUM(field) - Sum of values of field over retrieved records. Example: @DSUM(age) returns 224. @DCOUNT - Total number of records found for the current query. Example: We're sorting these records by group. After displaying all the records, @DCOUNT returns 6. @DSUBCOUNT - Count of records retrieved so far. Example: We're sorting these records by group. After displaying the records for group A, @DSUBCOUNT would return 2. Database Searching Functions The following group of functions are used for controlling data base searching and updating. Like control functions, these functions are used in button fields and in field commands that are set for immediate execution (i.e. Execute on Enter). Set Query Conditions @CNDX("docname","query", docfield1, docfield2, " qfield") - for the specified query defined in the specified document docname, set the first condition value of the query line whose field is qfield to the value in docfield1. Set the second condition (if any) to the value in docfield2. Both docfield1 and docfield2 may refer to fields in the current document. They may also be quoted text strings or numeric constants. In specifying docfield1 and docfield2 you can mix a numeric constant with numeric field reference or a text string with a text field reference. Docfield2 may be left out. @CNDX - without arguments, this function clears all query conditions set at the current document level. See the section "Using Database Searching Functions" in "Chapter 21: Advanced Database Topics" for a complete description of the use of this function. Surefire User's Guide Page 181 Execute a Query @QUERY("query") - The query with the specified name previously defined for the current document is executed. Use any conditions specified with @CNDX for this query. Example: @QUERY("cities") will start a search in the current document using the named query "cities". Join a Document @JOIN("document", "query") Go to the specified document and execute the query with the specified name. Use any conditions specified with @CNDX for this query. Example: @JOIN("trails", "colorado") will display the document trails and execute the named query colorado. Start a Search @SEARCH - Initiate a search based on the value of the current field in the current document. This is useful after the @GODOC, @FPASTE, @GOFIELD command combination. This function is equivalent to pressing (ALT+S) while the cursor is on a field. Update Record @UPDATE - Update the current database record with the values currently in the fields. This function is equivalent to pressing (ALT+U) after a database search has been done. Surefire User's Guide Page 182 Logical Value Functions A logical value can also be explicitly defined by using the functions @TRUE and @FALSE. These are in fact equivalent to using the numbers 1 for True and 0 for False, but are much more readable. @TRUE - equivalent to the value 1. @FALSE - equivalent to the value 0. Logical Condition Function A logical condition does something different based on whether the given logical expression is true or false. In other words you may want to take some action or do a calculation only if something else is True or False. To do this there is a special function: @IF(condx, true, false) The @IF function uses a logical expression for its first argument, condx. If the condition condx evaluates to TRUE, then the command specified as the argument true is executed. Otherwise the condition must be FALSE, so the command specified as the argument false is executed. Example: Let's say you have cells A1 that contains your income and B1 will have the tax you owe. And you have a simple tax rate of 10%. To make sure a negative tax is never calculated, use the following field command in cell B1. @IF( A1 >= 0, A1 * .10, 0 ). This will take the value in cell A1 and see whether it is greater than 0. If it is, the value is multiplied by .10, (or 10 percent). Otherwise the result is set to the third argument, zero. If cell A1 has the value $400, B1 will have the value $40. If cell A1 has the value ($500), that is a loss of $500, B1 will have the value $0. Using the @IF function, you can test logical field values that correspond to a person's Yes/No responses to questions. From this you determine which page or document of a "script" application is appropriate to that person's answer. Once there, after an @GOPAGE or @GODOC, the user can answer more questions, look at the result of a database search or look at a chart of information, for example.